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,
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
}
}
- 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)
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
- await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+ await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
await waitJobs(servers)
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)
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)
this.timeout(20000)
ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
- await waitUntilLivePublishedOnAllServers(liveVideoUUID)
+ await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
await waitJobs(servers)
await stopFfmpeg(ffmpegCommand)
- await waitUntilLiveSavedOnAllServers(liveVideoUUID)
+ await waitUntilLiveSavedOnAllServers(servers, liveVideoUUID)
await waitJobs(servers)
// Live has been transcoded
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)
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)