From aa887096f9a305568dc3a846d0c9cdf7e45f1c67 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 Oct 2022 14:18:59 +0200 Subject: Correctly delete live files from object storage --- server/tests/api/live/live-constraints.ts | 2 +- server/tests/api/live/live-permanent.ts | 12 ++++++++++++ server/tests/api/live/live-save-replay.ts | 18 +++++++++--------- 3 files changed, 22 insertions(+), 10 deletions(-) (limited to 'server/tests/api/live') diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 64ef73a2a..c82585a9e 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -49,7 +49,7 @@ describe('Test live constraints', function () { expect(video.duration).to.be.greaterThan(0) } - await checkLiveCleanup(servers[0], videoId, resolutions) + await checkLiveCleanup({ server: servers[0], permanent: false, videoUUID: videoId, savedResolutions: resolutions }) } function updateQuota (options: { total: number, daily: number }) { diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index 5d227200e..4203b1bfc 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' +import { checkLiveCleanup } from '@server/tests/shared' import { wait } from '@shared/core-utils' import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { @@ -129,6 +130,8 @@ describe('Permanent live', function () { expect(videoDetails.streamingPlaylists).to.have.lengthOf(0) } + + await checkLiveCleanup({ server: servers[0], permanent: true, videoUUID }) }) it('Should have set this live to waiting for live state', async function () { @@ -186,6 +189,15 @@ describe('Permanent live', function () { } }) + it('Should remove the live and have cleaned up the directory', async function () { + this.timeout(60000) + + await servers[0].videos.remove({ id: videoUUID }) + await waitJobs(servers) + + await checkLiveCleanup({ server: servers[0], permanent: true, videoUUID }) + }) + after(async function () { await cleanupTests(servers) }) diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 7014292d0..8f17b4566 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts @@ -186,7 +186,7 @@ describe('Save replay setting', function () { await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED) // No resolutions saved since we did not save replay - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) it('Should have appropriate ended session', async function () { @@ -220,7 +220,7 @@ describe('Save replay setting', function () { await wait(5000) await waitJobs(servers) - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) it('Should have blacklisted session error', async function () { @@ -238,7 +238,7 @@ describe('Save replay setting', function () { await publishLiveAndDelete({ permanent: false, replay: false }) await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) }) @@ -317,7 +317,7 @@ describe('Save replay setting', function () { }) it('Should have cleaned up the live files', async function () { - await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false, savedResolutions: [ 720 ] }) }) it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { @@ -332,7 +332,7 @@ describe('Save replay setting', function () { await wait(5000) await waitJobs(servers) - await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false, savedResolutions: [ 720 ] }) }) it('Should correctly terminate the stream on delete and delete the video', async function () { @@ -341,7 +341,7 @@ describe('Save replay setting', function () { await publishLiveAndDelete({ permanent: false, replay: true }) await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) }) @@ -413,7 +413,7 @@ describe('Save replay setting', function () { }) it('Should have cleaned up the live files', async function () { - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () { @@ -432,7 +432,7 @@ describe('Save replay setting', function () { await servers[1].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) } - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) it('Should correctly terminate the stream on delete and not save the video', async function () { @@ -444,7 +444,7 @@ describe('Save replay setting', function () { expect(replay).to.not.exist await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) - await checkLiveCleanup(servers[0], liveVideoUUID, []) + await checkLiveCleanup({ server: servers[0], videoUUID: liveVideoUUID, permanent: false }) }) }) -- cgit v1.2.3