]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/live/live-save-replay.ts
Merge branch 'release/4.0.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / live / live-save-replay.ts
index 8f1fb78a5c37daf233989fe1f88dabcd2ff68647..95a342b015e4afb887ec8a73388e670f9ffcef47 100644 (file)
@@ -3,8 +3,10 @@
 import 'mocha'
 import * as chai from 'chai'
 import { FfmpegCommand } from 'fluent-ffmpeg'
+import { checkLiveCleanupAfterSave } from '@server/tests/shared'
+import { wait } from '@shared/core-utils'
+import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
 import {
-  checkLiveCleanupAfterSave,
   cleanupTests,
   ConfigCommand,
   createMultipleServers,
@@ -14,10 +16,10 @@ import {
   setDefaultVideoChannel,
   stopFfmpeg,
   testFfmpegStreamError,
-  wait,
-  waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
+  waitJobs,
+  waitUntilLivePublishedOnAllServers,
+  waitUntilLiveSavedOnAllServers
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
@@ -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)