]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
More robust test
authorChocobozzz <me@florianbigard.com>
Mon, 15 May 2023 13:41:31 +0000 (15:41 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 15 May 2023 13:42:16 +0000 (15:42 +0200)
server/tests/api/users/users-multiple-servers.ts
shared/server-commands/videos/streaming-playlists-command.ts

index f94191b043b6398eddd0f8778b7ad3f5221cb08b..8d94362479ac7265bd087d8de99bdbf1c713d1c4 100644 (file)
@@ -148,8 +148,6 @@ describe('Test users with multiple servers', function () {
   })
 
   it('Should search through account videos', async function () {
-    this.timeout(10_000)
-
     const created = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } })
 
     await waitJobs(servers)
index 87aacc5f69ff2969d67c656ea644b9a4186a9e94..b988ac4b2ff382fde597899a2c4f85ba96c3b835 100644 (file)
@@ -14,7 +14,7 @@ export class StreamingPlaylistsCommand extends AbstractCommand {
     withRetry?: boolean // default false
     currentRetry?: number
   }): Promise<string> {
-    const { videoFileToken, reinjectVideoFileToken, withRetry = false, currentRetry = 1 } = options
+    const { videoFileToken, reinjectVideoFileToken, expectedStatus, withRetry = false, currentRetry = 1 } = options
 
     try {
       const result = await unwrapTextOrDecode(this.getRawRequest({
@@ -29,6 +29,11 @@ export class StreamingPlaylistsCommand extends AbstractCommand {
         defaultExpectedStatus: HttpStatusCode.OK_200
       }))
 
+      // master.m3u8 could be empty
+      if (!result && (!expectedStatus || expectedStatus === HttpStatusCode.OK_200)) {
+        throw new Error('Empty result')
+      }
+
       return result
     } catch (err) {
       if (!withRetry || currentRetry > 10) throw err