aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/server/handle-down.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/server/handle-down.ts')
-rw-r--r--server/tests/api/server/handle-down.ts25
1 files changed, 11 insertions, 14 deletions
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 889825936..55705caca 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -12,7 +12,7 @@ import {
12 wait 12 wait
13} from '../../utils/index' 13} from '../../utils/index'
14import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' 14import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows'
15import { getJobsListPaginationAndSort } from '../../utils/server/jobs' 15import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
16import { 16import {
17 addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, 17 addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
18 getVideoThreadComments 18 getVideoThreadComments
@@ -94,11 +94,11 @@ describe('Test handle downs', function () {
94 94
95 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken) 95 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken)
96 96
97 await wait(5000) 97 await waitJobs(servers)
98 98
99 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) 99 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
100 100
101 await wait(5000) 101 await waitJobs(servers)
102 102
103 for (const server of servers) { 103 for (const server of servers) {
104 const res = await getVideosList(server.url) 104 const res = await getVideosList(server.url)
@@ -118,7 +118,7 @@ describe('Test handle downs', function () {
118 videos.push(resVideo.body.video) 118 videos.push(resVideo.body.video)
119 } 119 }
120 120
121 await wait(2000) 121 await waitJobs(servers[0])
122 122
123 await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes) 123 await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes)
124 124
@@ -136,7 +136,9 @@ describe('Test handle downs', function () {
136 commentIdServer1 = resComment.body.comment.id 136 commentIdServer1 = resComment.body.comment.id
137 } 137 }
138 138
139 await wait(10000) 139 await waitJobs(servers[0])
140 // Wait scheduler
141 await wait(3000)
140 142
141 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt') 143 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt')
142 expect(res.body.data).to.be.an('array') 144 expect(res.body.data).to.be.an('array')
@@ -159,7 +161,7 @@ describe('Test handle downs', function () {
159 161
160 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken) 162 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken)
161 163
162 await wait(5000) 164 await waitJobs(servers)
163 165
164 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt') 166 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt')
165 expect(res.body.data).to.be.an('array') 167 expect(res.body.data).to.be.an('array')
@@ -171,7 +173,7 @@ describe('Test handle downs', function () {
171 173
172 await viewVideo(servers[0].url, videos[0].uuid) 174 await viewVideo(servers[0].url, videos[0].uuid)
173 175
174 await wait(5000) 176 await waitJobs(servers)
175 177
176 const res = await getVideosList(servers[1].url) 178 const res = await getVideosList(servers[1].url)
177 expect(res.body.data).to.be.an('array') 179 expect(res.body.data).to.be.an('array')
@@ -189,7 +191,7 @@ describe('Test handle downs', function () {
189 191
190 await addVideoCommentReply(servers[0].url, servers[0].accessToken, videos[1].uuid, commentIdServer1, 'comment 1-3') 192 await addVideoCommentReply(servers[0].url, servers[0].accessToken, videos[1].uuid, commentIdServer1, 'comment 1-3')
191 193
192 await wait(5000) 194 await waitJobs(servers)
193 195
194 const resVideo = await getVideo(servers[1].url, videos[0].uuid) 196 const resVideo = await getVideo(servers[1].url, videos[0].uuid)
195 expect(resVideo.body).not.to.be.undefined 197 expect(resVideo.body).not.to.be.undefined
@@ -230,7 +232,7 @@ describe('Test handle downs', function () {
230 232
231 await addVideoCommentReply(servers[1].url, servers[1].accessToken, videos[1].uuid, commentIdServer2, 'comment 1-4') 233 await addVideoCommentReply(servers[1].url, servers[1].accessToken, videos[1].uuid, commentIdServer2, 'comment 1-4')
232 234
233 await wait(5000) 235 await waitJobs(servers)
234 236
235 { 237 {
236 const resComment = await getVideoThreadComments(servers[0].url, videos[1].uuid, threadIdServer1) 238 const resComment = await getVideoThreadComments(servers[0].url, videos[1].uuid, threadIdServer1)
@@ -259,10 +261,5 @@ describe('Test handle downs', function () {
259 261
260 after(async function () { 262 after(async function () {
261 killallServers(servers) 263 killallServers(servers)
262
263 // Keep the logs if the test failed
264 if (this['ok']) {
265 await flushTests()
266 }
267 }) 264 })
268}) 265})