aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-abuse.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/api/videos/video-abuse.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/api/videos/video-abuse.ts')
-rw-r--r--server/tests/api/videos/video-abuse.ts18
1 files changed, 6 insertions, 12 deletions
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index f1c4ef0ce..dde309b96 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -5,17 +5,16 @@ import 'mocha'
5import { VideoAbuse } from '../../../../shared/models/videos' 5import { VideoAbuse } from '../../../../shared/models/videos'
6import { 6import {
7 flushAndRunMultipleServers, 7 flushAndRunMultipleServers,
8 flushTests,
9 getVideoAbusesList, 8 getVideoAbusesList,
10 getVideosList, 9 getVideosList,
11 killallServers, 10 killallServers,
12 reportVideoAbuse, 11 reportVideoAbuse,
13 ServerInfo, 12 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 uploadVideo, 14 uploadVideo
16 wait
17} from '../../utils/index' 15} from '../../utils/index'
18import { doubleFollow } from '../../utils/server/follows' 16import { doubleFollow } from '../../utils/server/follows'
17import { waitJobs } from '../../utils/server/jobs'
19 18
20const expect = chai.expect 19const expect = chai.expect
21 20
@@ -48,7 +47,7 @@ describe('Test video abuses', function () {
48 await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes) 47 await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes)
49 48
50 // Wait videos propagation, server 2 has transcoding enabled 49 // Wait videos propagation, server 2 has transcoding enabled
51 await wait(15000) 50 await waitJobs(servers)
52 51
53 const res = await getVideosList(servers[0].url) 52 const res = await getVideosList(servers[0].url)
54 const videos = res.body.data 53 const videos = res.body.data
@@ -68,13 +67,13 @@ describe('Test video abuses', function () {
68 }) 67 })
69 68
70 it('Should report abuse on a local video', async function () { 69 it('Should report abuse on a local video', async function () {
71 this.timeout(10000) 70 this.timeout(15000)
72 71
73 const reason = 'my super bad reason' 72 const reason = 'my super bad reason'
74 await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason) 73 await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason)
75 74
76 // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2 75 // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2
77 await wait(5000) 76 await waitJobs(servers)
78 }) 77 })
79 78
80 it('Should have 1 video abuses on server 1 and 0 on server 2', async function () { 79 it('Should have 1 video abuses on server 1 and 0 on server 2', async function () {
@@ -103,7 +102,7 @@ describe('Test video abuses', function () {
103 await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason) 102 await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason)
104 103
105 // We wait requests propagation 104 // We wait requests propagation
106 await wait(5000) 105 await waitJobs(servers)
107 }) 106 })
108 107
109 it('Should have 2 video abuse on server 1 and 1 on server 2', async function () { 108 it('Should have 2 video abuse on server 1 and 1 on server 2', async function () {
@@ -137,10 +136,5 @@ describe('Test video abuses', function () {
137 136
138 after(async function () { 137 after(async function () {
139 killallServers(servers) 138 killallServers(servers)
140
141 // Keep the logs if the test failed
142 if (this['ok']) {
143 await flushTests()
144 }
145 }) 139 })
146}) 140})