diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-10 09:28:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-10 09:30:33 +0200 |
commit | 5170f492b95dc81b75230312411c5fdb0019eed2 (patch) | |
tree | fea18f482e1eb16ac92fd2d08022b33d58ab8747 /server/tests | |
parent | 9d1e41e8bbd9afd961f2dd48c791a3be114e878d (diff) | |
download | PeerTube-5170f492b95dc81b75230312411c5fdb0019eed2.tar.gz PeerTube-5170f492b95dc81b75230312411c5fdb0019eed2.tar.zst PeerTube-5170f492b95dc81b75230312411c5fdb0019eed2.zip |
Try to have more robust live tests
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/transcoding/create-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/shared/live.ts | 3 | ||||
-rw-r--r-- | server/tests/shared/streaming-playlists.ts | 7 |
3 files changed, 7 insertions, 5 deletions
diff --git a/server/tests/api/transcoding/create-transcoding.ts b/server/tests/api/transcoding/create-transcoding.ts index 85389a949..5483c8dba 100644 --- a/server/tests/api/transcoding/create-transcoding.ts +++ b/server/tests/api/transcoding/create-transcoding.ts | |||
@@ -226,7 +226,7 @@ function runTests (objectStorage: boolean) { | |||
226 | const resolutions = hlsPlaylist.files.map(f => f.resolution.id) | 226 | const resolutions = hlsPlaylist.files.map(f => f.resolution.id) |
227 | await checkResolutionsInMasterPlaylist({ server: servers[0], playlistUrl: hlsPlaylist.playlistUrl, resolutions }) | 227 | await checkResolutionsInMasterPlaylist({ server: servers[0], playlistUrl: hlsPlaylist.playlistUrl, resolutions }) |
228 | 228 | ||
229 | const shaBody = await servers[0].streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) | 229 | const shaBody = await servers[0].streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: true }) |
230 | expect(Object.keys(shaBody)).to.have.lengthOf(5) | 230 | expect(Object.keys(shaBody)).to.have.lengthOf(5) |
231 | } | 231 | } |
232 | } | 232 | } |
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts index 31f92ef19..793503311 100644 --- a/server/tests/shared/live.ts +++ b/server/tests/shared/live.ts | |||
@@ -115,7 +115,8 @@ async function testLiveVideoResolutions (options: { | |||
115 | baseUrlSegment: baseUrl, | 115 | baseUrlSegment: baseUrl, |
116 | videoUUID: video.uuid, | 116 | videoUUID: video.uuid, |
117 | segmentName, | 117 | segmentName, |
118 | hlsPlaylist | 118 | hlsPlaylist, |
119 | withRetry: objectStorage // With object storage, the request may fail because of inconsistent data in S3 | ||
119 | }) | 120 | }) |
120 | 121 | ||
121 | if (originServer.internalServerNumber === server.internalServerNumber) { | 122 | if (originServer.internalServerNumber === server.internalServerNumber) { |
diff --git a/server/tests/shared/streaming-playlists.ts b/server/tests/shared/streaming-playlists.ts index acfb2b408..e4f88bc25 100644 --- a/server/tests/shared/streaming-playlists.ts +++ b/server/tests/shared/streaming-playlists.ts | |||
@@ -51,12 +51,13 @@ async function checkLiveSegmentHash (options: { | |||
51 | videoUUID: string | 51 | videoUUID: string |
52 | segmentName: string | 52 | segmentName: string |
53 | hlsPlaylist: VideoStreamingPlaylist | 53 | hlsPlaylist: VideoStreamingPlaylist |
54 | withRetry?: boolean | ||
54 | }) { | 55 | }) { |
55 | const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options | 56 | const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist, withRetry = false } = options |
56 | const command = server.streamingPlaylists | 57 | const command = server.streamingPlaylists |
57 | 58 | ||
58 | const segmentBody = await command.getFragmentedSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` }) | 59 | const segmentBody = await command.getFragmentedSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}`, withRetry }) |
59 | const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) | 60 | const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry }) |
60 | 61 | ||
61 | expect(sha256(segmentBody)).to.equal(shaBody[segmentName]) | 62 | expect(sha256(segmentBody)).to.equal(shaBody[segmentName]) |
62 | } | 63 | } |