diff options
Diffstat (limited to 'server/tests/api/live/live-fast-restream.ts')
-rw-r--r-- | server/tests/api/live/live-fast-restream.ts | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/server/tests/api/live/live-fast-restream.ts b/server/tests/api/live/live-fast-restream.ts index 502959258..c0bb8d529 100644 --- a/server/tests/api/live/live-fast-restream.ts +++ b/server/tests/api/live/live-fast-restream.ts | |||
@@ -43,12 +43,31 @@ describe('Fast restream in live', function () { | |||
43 | // Streaming session #1 | 43 | // Streaming session #1 |
44 | let ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) | 44 | let ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) |
45 | await server.live.waitUntilPublished({ videoId: liveVideoUUID }) | 45 | await server.live.waitUntilPublished({ videoId: liveVideoUUID }) |
46 | |||
47 | const video = await server.videos.get({ id: liveVideoUUID }) | ||
48 | const session1PlaylistId = video.streamingPlaylists[0].id | ||
49 | |||
46 | await stopFfmpeg(ffmpegCommand) | 50 | await stopFfmpeg(ffmpegCommand) |
47 | await server.live.waitUntilWaiting({ videoId: liveVideoUUID }) | 51 | await server.live.waitUntilWaiting({ videoId: liveVideoUUID }) |
48 | 52 | ||
49 | // Streaming session #2 | 53 | // Streaming session #2 |
50 | ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) | 54 | ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) |
51 | await server.live.waitUntilSegmentGeneration({ videoUUID: liveVideoUUID, segment: 0, playlistNumber: 0, totalSessions: 2 }) | 55 | |
56 | let hasNewPlaylist = false | ||
57 | do { | ||
58 | const video = await server.videos.get({ id: liveVideoUUID }) | ||
59 | hasNewPlaylist = video.streamingPlaylists.length === 1 && video.streamingPlaylists[0].id !== session1PlaylistId | ||
60 | |||
61 | await wait(100) | ||
62 | } while (!hasNewPlaylist) | ||
63 | |||
64 | await server.live.waitUntilSegmentGeneration({ | ||
65 | server, | ||
66 | videoUUID: liveVideoUUID, | ||
67 | segment: 1, | ||
68 | playlistNumber: 0, | ||
69 | objectStorage: false | ||
70 | }) | ||
52 | 71 | ||
53 | return { ffmpegCommand, liveVideoUUID } | 72 | return { ffmpegCommand, liveVideoUUID } |
54 | } | 73 | } |
@@ -59,9 +78,9 @@ describe('Fast restream in live', function () { | |||
59 | const video = await server.videos.get({ id: liveId }) | 78 | const video = await server.videos.get({ id: liveId }) |
60 | expect(video.streamingPlaylists).to.have.lengthOf(1) | 79 | expect(video.streamingPlaylists).to.have.lengthOf(1) |
61 | 80 | ||
62 | await server.live.getSegment({ videoUUID: liveId, segment: 0, playlistNumber: 0 }) | 81 | await server.live.getSegmentFile({ videoUUID: liveId, segment: 0, playlistNumber: 0 }) |
63 | await makeRawRequest(video.streamingPlaylists[0].playlistUrl, HttpStatusCode.OK_200) | 82 | await makeRawRequest({ url: video.streamingPlaylists[0].playlistUrl, expectedStatus: HttpStatusCode.OK_200 }) |
64 | await makeRawRequest(video.streamingPlaylists[0].segmentsSha256Url, HttpStatusCode.OK_200) | 83 | await makeRawRequest({ url: video.streamingPlaylists[0].segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 }) |
65 | 84 | ||
66 | await wait(100) | 85 | await wait(100) |
67 | } | 86 | } |
@@ -111,7 +130,7 @@ describe('Fast restream in live', function () { | |||
111 | }) | 130 | }) |
112 | 131 | ||
113 | it('Should correctly fast reastream in a permanent live with and without save replay', async function () { | 132 | it('Should correctly fast reastream in a permanent live with and without save replay', async function () { |
114 | this.timeout(240000) | 133 | this.timeout(480000) |
115 | 134 | ||
116 | // A test can take a long time, so prefer to run them in parallel | 135 | // A test can take a long time, so prefer to run them in parallel |
117 | await Promise.all([ | 136 | await Promise.all([ |