aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/ci.sh3
-rw-r--r--server/tests/api/live/live-save-replay.ts19
-rw-r--r--server/tests/api/notifications/user-notifications.ts2
-rw-r--r--server/tests/api/server/stats.ts4
-rw-r--r--shared/extra-utils/videos/live.ts12
5 files changed, 32 insertions, 8 deletions
diff --git a/scripts/ci.sh b/scripts/ci.sh
index 9399a0f59..d90c2cd10 100755
--- a/scripts/ci.sh
+++ b/scripts/ci.sh
@@ -10,11 +10,8 @@ fi
10killall -q peertube || true 10killall -q peertube || true
11 11
12retries=3 12retries=3
13jobs=2
14 13
15runTest () { 14runTest () {
16 retries=3
17
18 jobname=$1 15 jobname=$1
19 shift 16 shift
20 17
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 6dd6fb44e..61c8e74dd 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -23,9 +23,11 @@ import {
23 testFfmpegStreamError, 23 testFfmpegStreamError,
24 updateCustomSubConfig, 24 updateCustomSubConfig,
25 updateVideo, 25 updateVideo,
26 wait,
26 waitJobs, 27 waitJobs,
27 waitUntilLiveEnded, 28 waitUntilLiveEnded,
28 waitUntilLivePublished 29 waitUntilLivePublished,
30 waitUntilLiveSaved
29} from '../../../../shared/extra-utils' 31} from '../../../../shared/extra-utils'
30 32
31const expect = chai.expect 33const expect = chai.expect
@@ -81,6 +83,12 @@ describe('Save replay setting', function () {
81 } 83 }
82 } 84 }
83 85
86 async function waitUntilLiveSavedOnAllServers (videoId: string) {
87 for (const server of servers) {
88 await waitUntilLiveSaved(server.url, server.accessToken, videoId)
89 }
90 }
91
84 before(async function () { 92 before(async function () {
85 this.timeout(120000) 93 this.timeout(120000)
86 94
@@ -158,8 +166,6 @@ describe('Save replay setting', function () {
158 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200) 166 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
159 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED) 167 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
160 168
161 await waitJobs(servers)
162
163 // No resolutions saved since we did not save replay 169 // No resolutions saved since we did not save replay
164 await checkLiveCleanup(servers[0], liveVideoUUID, []) 170 await checkLiveCleanup(servers[0], liveVideoUUID, [])
165 }) 171 })
@@ -188,6 +194,8 @@ describe('Save replay setting', function () {
188 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401) 194 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
189 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) 195 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
190 196
197 await wait(5000)
198 await waitJobs(servers)
191 await checkLiveCleanup(servers[0], liveVideoUUID, []) 199 await checkLiveCleanup(servers[0], liveVideoUUID, [])
192 }) 200 })
193 201
@@ -208,6 +216,7 @@ describe('Save replay setting', function () {
208 removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 216 removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
209 ]) 217 ])
210 218
219 await wait(5000)
211 await waitJobs(servers) 220 await waitJobs(servers)
212 221
213 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) 222 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
@@ -245,6 +254,7 @@ describe('Save replay setting', function () {
245 254
246 await stopFfmpeg(ffmpegCommand) 255 await stopFfmpeg(ffmpegCommand)
247 256
257 await waitUntilLiveSavedOnAllServers(liveVideoUUID)
248 await waitJobs(servers) 258 await waitJobs(servers)
249 259
250 // Live has been transcoded 260 // Live has been transcoded
@@ -292,6 +302,8 @@ describe('Save replay setting', function () {
292 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401) 302 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
293 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) 303 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
294 304
305 await wait(5000)
306 await waitJobs(servers)
295 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) 307 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ])
296 }) 308 })
297 309
@@ -311,6 +323,7 @@ describe('Save replay setting', function () {
311 testFfmpegStreamError(ffmpegCommand, true) 323 testFfmpegStreamError(ffmpegCommand, true)
312 ]) 324 ])
313 325
326 await wait(5000)
314 await waitJobs(servers) 327 await waitJobs(servers)
315 328
316 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404) 329 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 6a65447fd..7e88d979b 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -314,7 +314,7 @@ describe('Test user notifications', function () {
314 }) 314 })
315 315
316 it('Should not send a notification before the video is published', async function () { 316 it('Should not send a notification before the video is published', async function () {
317 this.timeout(40000) 317 this.timeout(50000)
318 318
319 const updateAt = new Date(new Date().getTime() + 1000000) 319 const updateAt = new Date(new Date().getTime() + 1000000)
320 320
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index 82065e770..332c09585 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -195,12 +195,14 @@ describe('Test stats (excluding redundancy)', function () {
195 195
196 await waitJobs(servers) 196 await waitJobs(servers)
197 197
198 await wait(6000)
199
198 const res2 = await getStats(servers[1].url) 200 const res2 = await getStats(servers[1].url)
199 const second: ServerStats = res2.body 201 const second: ServerStats = res2.body
200 202
201 expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed) 203 expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed)
202 204
203 await wait(5000) 205 await wait(6000)
204 206
205 const res3 = await getStats(servers[1].url) 207 const res3 = await getStats(servers[1].url)
206 const third: ServerStats = res3.body 208 const third: ServerStats = res3.body
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index b0e499ce0..df7370008 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -164,6 +164,17 @@ async function waitUntilLiveState (url: string, token: string, videoId: number |
164 } while (video.state.id !== state) 164 } while (video.state.id !== state)
165} 165}
166 166
167async function waitUntilLiveSaved (url: string, token: string, videoId: number | string) {
168 let video: VideoDetails
169
170 do {
171 const res = await getVideoWithToken(url, token, videoId)
172 video = res.body
173
174 await wait(500)
175 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
176}
177
167async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { 178async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
168 const basePath = buildServerDirectory(server, 'streaming-playlists') 179 const basePath = buildServerDirectory(server, 'streaming-playlists')
169 const hlsPath = join(basePath, 'hls', videoUUID) 180 const hlsPath = join(basePath, 'hls', videoUUID)
@@ -203,6 +214,7 @@ async function getPlaylistsCount (server: ServerInfo, videoUUID: string) {
203export { 214export {
204 getLive, 215 getLive,
205 getPlaylistsCount, 216 getPlaylistsCount,
217 waitUntilLiveSaved,
206 waitUntilLivePublished, 218 waitUntilLivePublished,
207 updateLive, 219 updateLive,
208 createLive, 220 createLive,