aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/create-transcoding-job.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-13 10:06:50 +0200
committerChocobozzz <me@florianbigard.com>2018-06-13 10:22:53 +0200
commit3cd0734fd9b0ff21aaef02317a874e8f1c06e027 (patch)
tree9e8622d269919addd35b462141ab5f22236aa6f4 /server/tests/cli/create-transcoding-job.ts
parent2186386cca113506791583cb07d6ccacba7af4e0 (diff)
downloadPeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.tar.gz
PeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.tar.zst
PeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.zip
Improve tests when waiting pending jobs
Diffstat (limited to 'server/tests/cli/create-transcoding-job.ts')
-rw-r--r--server/tests/cli/create-transcoding-job.ts23
1 files changed, 9 insertions, 14 deletions
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index fe1c0c03d..e7c36f9c6 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -3,22 +3,22 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoDetails } from '../../../shared/models/videos' 5import { VideoDetails } from '../../../shared/models/videos'
6const expect = chai.expect
7
8import { 6import {
7 doubleFollow,
9 execCLI, 8 execCLI,
9 flushAndRunMultipleServers,
10 flushTests, 10 flushTests,
11 getEnvCli, 11 getEnvCli,
12 getVideo,
12 getVideosList, 13 getVideosList,
13 killallServers, 14 killallServers,
14 parseTorrentVideo,
15 runServer,
16 ServerInfo, 15 ServerInfo,
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 uploadVideo, 17 uploadVideo, wait
19 wait,
20 getVideo, flushAndRunMultipleServers, doubleFollow
21} from '../utils' 18} from '../utils'
19import { waitJobs } from '../utils/server/jobs'
20
21const expect = chai.expect
22 22
23describe('Test create transcoding jobs', function () { 23describe('Test create transcoding jobs', function () {
24 let servers: ServerInfo[] = [] 24 let servers: ServerInfo[] = []
@@ -40,7 +40,7 @@ describe('Test create transcoding jobs', function () {
40 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video2' }) 40 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video2' })
41 video2UUID = res.body.video.uuid 41 video2UUID = res.body.video.uuid
42 42
43 await wait(3000) 43 await waitJobs(servers)
44 }) 44 })
45 45
46 it('Should have two video files on each server', async function () { 46 it('Should have two video files on each server', async function () {
@@ -65,7 +65,7 @@ describe('Test create transcoding jobs', function () {
65 const env = getEnvCli(servers[0]) 65 const env = getEnvCli(servers[0])
66 await execCLI(`${env} npm run create-transcoding-job -- -v ${video2UUID}`) 66 await execCLI(`${env} npm run create-transcoding-job -- -v ${video2UUID}`)
67 67
68 await wait(40000) 68 await waitJobs(servers)
69 69
70 for (const server of servers) { 70 for (const server of servers) {
71 const res = await getVideosList(server.url) 71 const res = await getVideosList(server.url)
@@ -102,10 +102,5 @@ describe('Test create transcoding jobs', function () {
102 102
103 after(async function () { 103 after(async function () {
104 killallServers(servers) 104 killallServers(servers)
105
106 // Keep the logs if the test failed
107 if (this['ok']) {
108 await flushTests()
109 }
110 }) 105 })
111}) 106})