]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/shared/live.ts
Update angular
[github/Chocobozzz/PeerTube.git] / server / tests / shared / live.ts
index 7935033110cff50e8324847454c0853bd692f9dc..9d8c1d941890d58f8678f5f4ec8687815a1bda94 100644 (file)
@@ -46,7 +46,7 @@ async function testLiveVideoResolutions (options: {
   resolutions: number[]
   transcoded: boolean
 
-  objectStorage: boolean
+  objectStorage?: ObjectStorageCommand
   objectStorageBaseUrl?: string
 }) {
   const {
@@ -57,7 +57,7 @@ async function testLiveVideoResolutions (options: {
     resolutions,
     transcoded,
     objectStorage,
-    objectStorageBaseUrl = ObjectStorageCommand.getMockPlaylistBaseUrl()
+    objectStorageBaseUrl = objectStorage?.getMockPlaylistBaseUrl()
   } = options
 
   for (const server of servers) {
@@ -76,7 +76,7 @@ async function testLiveVideoResolutions (options: {
       playlistUrl: hlsPlaylist.playlistUrl,
       resolutions,
       transcoded,
-      withRetry: objectStorage
+      withRetry: !!objectStorage
     })
 
     if (objectStorage) {
@@ -105,7 +105,7 @@ async function testLiveVideoResolutions (options: {
 
       const subPlaylist = await originServer.streamingPlaylists.get({
         url: `${baseUrl}/${video.uuid}/${i}.m3u8`,
-        withRetry: objectStorage // With object storage, the request may fail because of inconsistent data in S3
+        withRetry: !!objectStorage // With object storage, the request may fail because of inconsistent data in S3
       })
 
       expect(subPlaylist).to.contain(segmentName)
@@ -116,7 +116,7 @@ async function testLiveVideoResolutions (options: {
         videoUUID: video.uuid,
         segmentName,
         hlsPlaylist,
-        withRetry: objectStorage // With object storage, the request may fail because of inconsistent data in S3
+        withRetry: !!objectStorage // With object storage, the request may fail because of inconsistent data in S3
       })
 
       if (originServer.internalServerNumber === server.internalServerNumber) {
@@ -142,7 +142,7 @@ async function checkSavedLiveCleanup (hlsPath: string, savedResolutions: number[
   const files = await readdir(hlsPath)
 
   // fragmented file and playlist per resolution + master playlist + segments sha256 json file
-  expect(files).to.have.lengthOf(savedResolutions.length * 2 + 2)
+  expect(files, `Directory content: ${files.join(', ')}`).to.have.lengthOf(savedResolutions.length * 2 + 2)
 
   for (const resolution of savedResolutions) {
     const fragmentedFile = files.find(f => f.endsWith(`-${resolution}-fragmented.mp4`))