]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/live/live-save-replay.ts
Add support for saving video files to object storage (#4290)
[github/Chocobozzz/PeerTube.git] / server / tests / api / live / live-save-replay.ts
index 8f1fb78a5c37daf233989fe1f88dabcd2ff68647..6c4ea90ca881683a60b22dde56a82c5923d4dc35 100644 (file)
@@ -15,7 +15,9 @@ import {
   stopFfmpeg,
   testFfmpegStreamError,
   wait,
-  waitJobs
+  waitJobs,
+  waitUntilLivePublishedOnAllServers,
+  waitUntilLiveSavedOnAllServers
 } from '@shared/extra-utils'
 import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
 
@@ -66,18 +68,6 @@ describe('Save replay setting', function () {
     }
   }
 
-  async function waitUntilLivePublishedOnAllServers (videoId: string) {
-    for (const server of servers) {
-      await server.live.waitUntilPublished({ videoId })
-    }
-  }
-
-  async function waitUntilLiveSavedOnAllServers (videoId: string) {
-    for (const server of servers) {
-      await server.live.waitUntilSaved({ videoId })
-    }
-  }
-
   before(async function () {
     this.timeout(120000)
 
@@ -127,7 +117,7 @@ describe('Save replay setting', function () {
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
 
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
 
@@ -160,7 +150,7 @@ describe('Save replay setting', function () {
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
 
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
       await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -189,7 +179,7 @@ describe('Save replay setting', function () {
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
 
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
       await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -224,7 +214,7 @@ describe('Save replay setting', function () {
       this.timeout(20000)
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
 
@@ -237,7 +227,7 @@ describe('Save replay setting', function () {
 
       await stopFfmpeg(ffmpegCommand)
 
-      await waitUntilLiveSavedOnAllServers(liveVideoUUID)
+      await waitUntilLiveSavedOnAllServers(servers, liveVideoUUID)
       await waitJobs(servers)
 
       // Live has been transcoded
@@ -268,7 +258,7 @@ describe('Save replay setting', function () {
       liveVideoUUID = await createLiveWrapper(true)
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
       await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -296,7 +286,7 @@ describe('Save replay setting', function () {
       liveVideoUUID = await createLiveWrapper(true)
 
       ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
-      await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+      await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
 
       await waitJobs(servers)
       await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)