From f1569117f9bc468bc38b5b8d32df1bce40cc42ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Dec 2021 11:36:51 +0100 Subject: Cleanup unavailable remote AP resource --- server/tests/api/activitypub/cleaner.ts | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'server/tests/api') diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index 7a443b553..dc885023a 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts @@ -270,6 +270,59 @@ describe('Test AP cleaner', function () { await checkRemote('kyle') }) + it('Should remove unavailable remote resources', async function () { + this.timeout(240000) + + async function expectNotDeleted () { + { + const video = await servers[0].videos.get({ id: uuid }) + + expect(video.likes).to.equal(3) + expect(video.dislikes).to.equal(0) + } + + { + const { total } = await servers[0].comments.listThreads({ videoId: uuid }) + expect(total).to.equal(3) + } + } + + async function expectDeleted () { + { + const video = await servers[0].videos.get({ id: uuid }) + + expect(video.likes).to.equal(3) + expect(video.dislikes).to.equal(0) + } + + { + const { total } = await servers[0].comments.listThreads({ videoId: videoUUID1 }) + expect(total).to.equal(2) + } + } + + const uuid = (await servers[0].videos.quickUpload({ name: 'server 1 video 2' })).uuid + + await waitJobs(servers) + + for (const server of servers) { + await server.videos.rate({ id: uuid, rating: 'like' }) + await server.comments.createThread({ videoId: uuid, text: 'comment' }) + } + + await waitJobs(servers) + + await expectNotDeleted() + + await servers[1].kill() + + await wait(5000) + await expectNotDeleted() + + await wait(15000) + await expectDeleted() + }) + after(async function () { await cleanupTests(servers) }) -- cgit v1.2.3