diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-23 10:49:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-23 10:49:45 +0200 |
commit | f89189907bbdff6c4bc6d3460ed9ef4c49515f17 (patch) | |
tree | c55e50e3fc02ae9b3f2d1d19d95160af98cc7d7c /shared/server-commands/videos/live-command.ts | |
parent | 41cde76bbf5ac16a90b5f158672523069db74009 (diff) | |
download | PeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.tar.gz PeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.tar.zst PeerTube-f89189907bbdff6c4bc6d3460ed9ef4c49515f17.zip |
Prevent object storage mock conflicts
When running tests in parallel
Diffstat (limited to 'shared/server-commands/videos/live-command.ts')
-rw-r--r-- | shared/server-commands/videos/live-command.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index 73f4eefd3..44d625970 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts | |||
@@ -192,7 +192,7 @@ export class LiveCommand extends AbstractCommand { | |||
192 | videoUUID: string | 192 | videoUUID: string |
193 | playlistNumber: number | 193 | playlistNumber: number |
194 | segment: number | 194 | segment: number |
195 | objectStorage: boolean | 195 | objectStorage?: ObjectStorageCommand |
196 | objectStorageBaseUrl?: string | 196 | objectStorageBaseUrl?: string |
197 | }) { | 197 | }) { |
198 | const { | 198 | const { |
@@ -201,12 +201,12 @@ export class LiveCommand extends AbstractCommand { | |||
201 | playlistNumber, | 201 | playlistNumber, |
202 | segment, | 202 | segment, |
203 | videoUUID, | 203 | videoUUID, |
204 | objectStorageBaseUrl = ObjectStorageCommand.getMockPlaylistBaseUrl() | 204 | objectStorageBaseUrl |
205 | } = options | 205 | } = options |
206 | 206 | ||
207 | const segmentName = `${playlistNumber}-00000${segment}.ts` | 207 | const segmentName = `${playlistNumber}-00000${segment}.ts` |
208 | const baseUrl = objectStorage | 208 | const baseUrl = objectStorage |
209 | ? join(objectStorageBaseUrl, 'hls') | 209 | ? join(objectStorageBaseUrl || objectStorage.getMockPlaylistBaseUrl(), 'hls') |
210 | : server.url + '/static/streaming-playlists/hls' | 210 | : server.url + '/static/streaming-playlists/hls' |
211 | 211 | ||
212 | let error = true | 212 | let error = true |
@@ -226,7 +226,7 @@ export class LiveCommand extends AbstractCommand { | |||
226 | const hlsPlaylist = video.streamingPlaylists[0] | 226 | const hlsPlaylist = video.streamingPlaylists[0] |
227 | 227 | ||
228 | // Check SHA generation | 228 | // Check SHA generation |
229 | const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: objectStorage }) | 229 | const shaBody = await server.streamingPlaylists.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url, withRetry: !!objectStorage }) |
230 | if (!shaBody[segmentName]) { | 230 | if (!shaBody[segmentName]) { |
231 | throw new Error('Segment SHA does not exist') | 231 | throw new Error('Segment SHA does not exist') |
232 | } | 232 | } |
@@ -261,13 +261,13 @@ export class LiveCommand extends AbstractCommand { | |||
261 | videoUUID: string | 261 | videoUUID: string |
262 | playlistNumber: number | 262 | playlistNumber: number |
263 | segment: number | 263 | segment: number |
264 | objectStorage?: boolean // default false | 264 | objectStorage?: ObjectStorageCommand |
265 | }) { | 265 | }) { |
266 | const { playlistNumber, segment, videoUUID, objectStorage = false } = options | 266 | const { playlistNumber, segment, videoUUID, objectStorage } = options |
267 | 267 | ||
268 | const segmentName = `${playlistNumber}-00000${segment}.ts` | 268 | const segmentName = `${playlistNumber}-00000${segment}.ts` |
269 | const baseUrl = objectStorage | 269 | const baseUrl = objectStorage |
270 | ? ObjectStorageCommand.getMockPlaylistBaseUrl() | 270 | ? objectStorage.getMockPlaylistBaseUrl() |
271 | : `${this.server.url}/static/streaming-playlists/hls` | 271 | : `${this.server.url}/static/streaming-playlists/hls` |
272 | 272 | ||
273 | const url = `${baseUrl}/${videoUUID}/${segmentName}` | 273 | const url = `${baseUrl}/${videoUUID}/${segmentName}` |
@@ -284,12 +284,12 @@ export class LiveCommand extends AbstractCommand { | |||
284 | getPlaylistFile (options: OverrideCommandOptions & { | 284 | getPlaylistFile (options: OverrideCommandOptions & { |
285 | videoUUID: string | 285 | videoUUID: string |
286 | playlistName: string | 286 | playlistName: string |
287 | objectStorage?: boolean // default false | 287 | objectStorage?: ObjectStorageCommand |
288 | }) { | 288 | }) { |
289 | const { playlistName, videoUUID, objectStorage = false } = options | 289 | const { playlistName, videoUUID, objectStorage } = options |
290 | 290 | ||
291 | const baseUrl = objectStorage | 291 | const baseUrl = objectStorage |
292 | ? ObjectStorageCommand.getMockPlaylistBaseUrl() | 292 | ? objectStorage.getMockPlaylistBaseUrl() |
293 | : `${this.server.url}/static/streaming-playlists/hls` | 293 | : `${this.server.url}/static/streaming-playlists/hls` |
294 | 294 | ||
295 | const url = `${baseUrl}/${videoUUID}/${playlistName}` | 295 | const url = `${baseUrl}/${videoUUID}/${playlistName}` |