From bbae45c32ea41ba4926b291fac5f594c94d5aa9d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Oct 2022 16:00:11 +0200 Subject: Fix live tests --- server/tests/api/live/live-fast-restream.ts | 21 ++++++++++++++++++++- server/tests/api/live/live.ts | 12 +++++++++--- .../api/notifications/moderation-notifications.ts | 2 +- server/tests/shared/live.ts | 10 +++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) (limited to 'server') diff --git a/server/tests/api/live/live-fast-restream.ts b/server/tests/api/live/live-fast-restream.ts index 3ea6be9ff..772ea792d 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 () { // Streaming session #1 let ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) await server.live.waitUntilPublished({ videoId: liveVideoUUID }) + + const video = await server.videos.get({ id: liveVideoUUID }) + const session1PlaylistId = video.streamingPlaylists[0].id + await stopFfmpeg(ffmpegCommand) await server.live.waitUntilWaiting({ videoId: liveVideoUUID }) // Streaming session #2 ffmpegCommand = await server.live.sendRTMPStreamInVideo(rtmpOptions) - await server.live.waitUntilSegmentGeneration({ videoUUID: liveVideoUUID, segment: 0, playlistNumber: 0, totalSessions: 2 }) + + let hasNewPlaylist = false + do { + const video = await server.videos.get({ id: liveVideoUUID }) + hasNewPlaylist = video.streamingPlaylists.length === 1 && video.streamingPlaylists[0].id !== session1PlaylistId + + await wait(100) + } while (!hasNewPlaylist) + + await server.live.waitUntilSegmentGeneration({ + server, + videoUUID: liveVideoUUID, + segment: 1, + playlistNumber: 0, + objectStorage: false + }) return { ffmpegCommand, liveVideoUUID } } diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 5dd2bd9ab..0a7ae8536 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts @@ -695,9 +695,15 @@ describe('Test live', function () { commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) ]) - await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, playlistNumber: 0, segment: 2 }) - await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, playlistNumber: 0, segment: 2 }) - await commands[0].waitUntilSegmentGeneration({ videoUUID: permanentLiveVideoReplayId, playlistNumber: 0, segment: 2 }) + for (const videoUUID of [ liveVideoId, liveVideoReplayId, permanentLiveVideoReplayId ]) { + await commands[0].waitUntilSegmentGeneration({ + server: servers[0], + videoUUID, + playlistNumber: 0, + segment: 2, + objectStorage: false + }) + } { const video = await servers[0].videos.get({ id: permanentLiveVideoReplayId }) diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index fc953f144..5a632fb22 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts @@ -545,7 +545,7 @@ describe('Test moderation notifications', function () { }) it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () { - this.timeout(40000) + this.timeout(120000) const updateAt = new Date(new Date().getTime() + 1000000) diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts index 63f3ecfd8..da3691711 100644 --- a/server/tests/shared/live.ts +++ b/server/tests/shared/live.ts @@ -56,15 +56,19 @@ async function testVideoResolutions (options: { for (let i = 0; i < resolutions.length; i++) { const segmentNum = 3 const segmentName = `${i}-00000${segmentNum}.ts` - await originServer.live.waitUntilSegmentGeneration({ videoUUID: video.uuid, playlistNumber: i, segment: segmentNum }) + await originServer.live.waitUntilSegmentGeneration({ + server: originServer, + videoUUID: video.uuid, + playlistNumber: i, + segment: segmentNum, + objectStorage + }) const baseUrl = objectStorage ? ObjectStorageCommand.getPlaylistBaseUrl() + 'hls' : originServer.url + '/static/streaming-playlists/hls' if (objectStorage) { - await originServer.live.waitUntilSegmentUpload({ playlistNumber: i, segment: segmentNum }) - expect(hlsPlaylist.segmentsSha256Url).to.contain(ObjectStorageCommand.getPlaylistBaseUrl()) } -- cgit v1.2.3