+ const video = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(video).to.exist
+
+ for (const server of servers) {
+ await server.videos.get({ id: video.uuid })
+ }
+
+ lastReplayUUID = video.uuid
+ })
+
+ it('Should have appropriate ended session and replay live session', async function () {
+ const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID })
+ expect(total).to.equal(1)
+ expect(data).to.have.lengthOf(1)
+
+ const sessionFromLive = data[0]
+ const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID })
+
+ for (const session of [ sessionFromLive, sessionFromReplay ]) {
+ expect(session.startDate).to.exist
+ expect(session.endDate).to.exist
+
+ expect(session.error).to.not.exist
+
+ expect(session.replayVideo).to.exist
+ expect(session.replayVideo.id).to.exist
+ expect(session.replayVideo.shortUUID).to.exist
+ expect(session.replayVideo.uuid).to.equal(lastReplayUUID)
+ }
+ })
+
+ it('Should have cleaned up the live files', async function () {
+ await checkLiveCleanup(servers[0], liveVideoUUID, [])
+ })
+
+ it('Should correctly terminate the stream on blacklist and blacklist the saved replay video', async function () {
+ this.timeout(60000)
+
+ await servers[0].videos.remove({ id: lastReplayUUID })
+ const { liveDetails } = await publishLiveAndBlacklist({ permanent: true, replay: true })
+
+ const replay = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(replay).to.exist
+
+ for (const videoId of [ liveVideoUUID, replay.uuid ]) {
+ await checkVideosExist(videoId, false)
+
+ await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+ await servers[1].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+ }
+
+ await checkLiveCleanup(servers[0], liveVideoUUID, [])
+ })
+
+ it('Should correctly terminate the stream on delete and not save the video', async function () {
+ this.timeout(40000)
+
+ const { liveDetails } = await publishLiveAndDelete({ permanent: true, replay: true })
+
+ const replay = await findExternalSavedVideo(servers[0], liveDetails)
+ expect(replay).to.not.exist
+