diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-13 10:06:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-13 10:22:53 +0200 |
commit | 3cd0734fd9b0ff21aaef02317a874e8f1c06e027 (patch) | |
tree | 9e8622d269919addd35b462141ab5f22236aa6f4 /server/tests/cli | |
parent | 2186386cca113506791583cb07d6ccacba7af4e0 (diff) | |
download | PeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.tar.gz PeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.tar.zst PeerTube-3cd0734fd9b0ff21aaef02317a874e8f1c06e027.zip |
Improve tests when waiting pending jobs
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/create-import-video-file-job.ts | 17 | ||||
-rw-r--r-- | server/tests/cli/create-transcoding-job.ts | 23 | ||||
-rw-r--r-- | server/tests/cli/reset-password.ts | 5 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 18 |
4 files changed, 22 insertions, 41 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 1472e60f6..13bcfd209 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts | |||
@@ -14,9 +14,9 @@ import { | |||
14 | killallServers, | 14 | killallServers, |
15 | ServerInfo, | 15 | ServerInfo, |
16 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
17 | uploadVideo, | 17 | uploadVideo |
18 | wait | ||
19 | } from '../utils' | 18 | } from '../utils' |
19 | import { waitJobs } from '../utils/server/jobs' | ||
20 | 20 | ||
21 | const expect = chai.expect | 21 | const expect = chai.expect |
22 | 22 | ||
@@ -54,14 +54,14 @@ describe('Test create import video jobs', function () { | |||
54 | video2UUID = res2.body.video.uuid | 54 | video2UUID = res2.body.video.uuid |
55 | 55 | ||
56 | // Transcoding | 56 | // Transcoding |
57 | await wait(40000) | 57 | await waitJobs(servers) |
58 | }) | 58 | }) |
59 | 59 | ||
60 | it('Should run a import job on video 1 with a lower resolution', async function () { | 60 | it('Should run a import job on video 1 with a lower resolution', async function () { |
61 | const env = getEnvCli(servers[0]) | 61 | const env = getEnvCli(servers[0]) |
62 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`) | 62 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short-480.webm`) |
63 | 63 | ||
64 | await wait(30000) | 64 | await waitJobs(servers) |
65 | 65 | ||
66 | let magnetUri: string | 66 | let magnetUri: string |
67 | for (const server of servers) { | 67 | for (const server of servers) { |
@@ -85,7 +85,7 @@ describe('Test create import video jobs', function () { | |||
85 | const env = getEnvCli(servers[1]) | 85 | const env = getEnvCli(servers[1]) |
86 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`) | 86 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`) |
87 | 87 | ||
88 | await wait(30000) | 88 | await waitJobs(servers) |
89 | 89 | ||
90 | let magnetUri: string | 90 | let magnetUri: string |
91 | for (const server of servers) { | 91 | for (const server of servers) { |
@@ -111,7 +111,7 @@ describe('Test create import video jobs', function () { | |||
111 | const env = getEnvCli(servers[0]) | 111 | const env = getEnvCli(servers[0]) |
112 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`) | 112 | await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`) |
113 | 113 | ||
114 | await wait(30000) | 114 | await waitJobs(servers) |
115 | 115 | ||
116 | let magnetUri: string | 116 | let magnetUri: string |
117 | for (const server of servers) { | 117 | for (const server of servers) { |
@@ -133,10 +133,5 @@ describe('Test create import video jobs', function () { | |||
133 | 133 | ||
134 | after(async function () { | 134 | after(async function () { |
135 | killallServers(servers) | 135 | killallServers(servers) |
136 | |||
137 | // Keep the logs if the test failed | ||
138 | if (this['ok']) { | ||
139 | await flushTests() | ||
140 | } | ||
141 | }) | 136 | }) |
142 | }) | 137 | }) |
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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoDetails } from '../../../shared/models/videos' | 5 | import { VideoDetails } from '../../../shared/models/videos' |
6 | const expect = chai.expect | ||
7 | |||
8 | import { | 6 | import { |
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' |
19 | import { waitJobs } from '../utils/server/jobs' | ||
20 | |||
21 | const expect = chai.expect | ||
22 | 22 | ||
23 | describe('Test create transcoding jobs', function () { | 23 | describe('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 | }) |
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts index 98ea7d456..bf937d1c0 100644 --- a/server/tests/cli/reset-password.ts +++ b/server/tests/cli/reset-password.ts | |||
@@ -36,10 +36,5 @@ describe('Test reset password scripts', function () { | |||
36 | 36 | ||
37 | after(async function () { | 37 | after(async function () { |
38 | killallServers([ server ]) | 38 | killallServers([ server ]) |
39 | |||
40 | // Keep the logs if the test failed | ||
41 | if (this['ok']) { | ||
42 | await flushTests() | ||
43 | } | ||
44 | }) | 39 | }) |
45 | }) | 40 | }) |
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index ad56f7b1b..d0c6d2042 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts | |||
@@ -3,22 +3,22 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoDetails } from '../../../shared/models/videos' | 5 | import { VideoDetails } from '../../../shared/models/videos' |
6 | const expect = chai.expect | ||
7 | |||
8 | import { | 6 | import { |
9 | execCLI, | 7 | execCLI, |
10 | flushTests, | 8 | flushTests, |
11 | getEnvCli, | 9 | getEnvCli, |
10 | getVideo, | ||
12 | getVideosList, | 11 | getVideosList, |
13 | killallServers, | 12 | killallServers, |
14 | parseTorrentVideo, | 13 | parseTorrentVideo, |
15 | runServer, | 14 | runServer, |
16 | ServerInfo, | 15 | ServerInfo, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
18 | uploadVideo, | 17 | uploadVideo |
19 | wait, | ||
20 | getVideo | ||
21 | } from '../utils' | 18 | } from '../utils' |
19 | import { waitJobs } from '../utils/server/jobs' | ||
20 | |||
21 | const expect = chai.expect | ||
22 | 22 | ||
23 | describe('Test update host scripts', function () { | 23 | describe('Test update host scripts', function () { |
24 | let server: ServerInfo | 24 | let server: ServerInfo |
@@ -41,7 +41,8 @@ describe('Test update host scripts', function () { | |||
41 | const videoAttributes = {} | 41 | const videoAttributes = {} |
42 | await uploadVideo(server.url, server.accessToken, videoAttributes) | 42 | await uploadVideo(server.url, server.accessToken, videoAttributes) |
43 | await uploadVideo(server.url, server.accessToken, videoAttributes) | 43 | await uploadVideo(server.url, server.accessToken, videoAttributes) |
44 | await wait(30000) | 44 | |
45 | await waitJobs(server) | ||
45 | }) | 46 | }) |
46 | 47 | ||
47 | it('Should update torrent hosts', async function () { | 48 | it('Should update torrent hosts', async function () { |
@@ -82,10 +83,5 @@ describe('Test update host scripts', function () { | |||
82 | 83 | ||
83 | after(async function () { | 84 | after(async function () { |
84 | killallServers([ server ]) | 85 | killallServers([ server ]) |
85 | |||
86 | // Keep the logs if the test failed | ||
87 | if (this['ok']) { | ||
88 | await flushTests() | ||
89 | } | ||
90 | }) | 86 | }) |
91 | }) | 87 | }) |