]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/create-import-video-file-job.ts
Add ability to specify channel on registration
[github/Chocobozzz/PeerTube.git] / server / tests / cli / create-import-video-file-job.ts
index 1472e60f6fb5630910f54ea827b500c825ae1b7a..0d378c1aa16d2688ada8658f015cf8074c5bd1fc 100644 (file)
@@ -4,6 +4,7 @@ import 'mocha'
 import * as chai from 'chai'
 import { VideoDetails, VideoFile } from '../../../shared/models/videos'
 import {
+  cleanupTests,
   doubleFollow,
   execCLI,
   flushAndRunMultipleServers,
@@ -14,9 +15,9 @@ import {
   killallServers,
   ServerInfo,
   setAccessTokensToServers,
-  uploadVideo,
-  wait
-} from '../utils'
+  uploadVideo
+} from '../../../shared/extra-utils'
+import { waitJobs } from '../../../shared/extra-utils/server/jobs'
 
 const expect = chai.expect
 
@@ -39,7 +40,6 @@ describe('Test create import video jobs', function () {
 
   before(async function () {
     this.timeout(90000)
-    await flushTests()
 
     // Run server 2 to have transcoding enabled
     servers = await flushAndRunMultipleServers(2)
@@ -54,14 +54,14 @@ describe('Test create import video jobs', function () {
     video2UUID = res2.body.video.uuid
 
     // Transcoding
-    await wait(40000)
+    await waitJobs(servers)
   })
 
   it('Should run a import job on video 1 with a lower resolution', async function () {
     const env = getEnvCli(servers[0])
     await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`)
 
-    await wait(30000)
+    await waitJobs(servers)
 
     let magnetUri: string
     for (const server of servers) {
@@ -85,7 +85,7 @@ describe('Test create import video jobs', function () {
     const env = getEnvCli(servers[1])
     await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`)
 
-    await wait(30000)
+    await waitJobs(servers)
 
     let magnetUri: string
     for (const server of servers) {
@@ -111,7 +111,7 @@ describe('Test create import video jobs', function () {
     const env = getEnvCli(servers[0])
     await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`)
 
-    await wait(30000)
+    await waitJobs(servers)
 
     let magnetUri: string
     for (const server of servers) {
@@ -132,11 +132,6 @@ describe('Test create import video jobs', function () {
   })
 
   after(async function () {
-    killallServers(servers)
-
-    // Keep the logs if the test failed
-    if (this['ok']) {
-      await flushTests()
-    }
+    await cleanupTests(servers)
   })
 })