From 5333788c08ab6152303829d4624774b5d788ff40 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 May 2022 14:54:16 +0200 Subject: Fix saving permanent live replay on quick restream --- server/tests/api/live/live-save-replay.ts | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'server/tests/api/live/live-save-replay.ts') diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 7ddcb04ef..007af51e9 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts @@ -441,6 +441,40 @@ describe('Save replay setting', function () { await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) await checkLiveCleanup(servers[0], liveVideoUUID, []) }) + + it('Should correctly save replays with multiple sessions', async function () { + this.timeout(120000) + + liveVideoUUID = await createLiveWrapper({ permanent: true, replay: true }) + await waitJobs(servers) + + // Streaming session #1 + ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) + await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) + await stopFfmpeg(ffmpegCommand) + await servers[0].live.waitUntilWaiting({ videoId: liveVideoUUID }) + + // Streaming session #2 + ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) + await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) + await stopFfmpeg(ffmpegCommand) + await waitUntilLiveWaitingOnAllServers(servers, liveVideoUUID) + + // Wait for replays + await waitJobs(servers) + + const { total, data: sessions } = await servers[0].live.listSessions({ videoId: liveVideoUUID }) + + expect(total).to.equal(2) + expect(sessions).to.have.lengthOf(2) + + for (const session of sessions) { + expect(session.error).to.be.null + expect(session.replayVideo).to.exist + + await servers[0].videos.get({ id: session.replayVideo.uuid }) + } + }) }) after(async function () { -- cgit v1.2.3