diff options
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/live.ts | 6 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 6 | ||||
-rw-r--r-- | server/tests/api/live/live-save-replay.ts | 14 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 37 |
4 files changed, 32 insertions, 31 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 40dca908b..7e76caf6e 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -22,7 +22,7 @@ import { | |||
22 | updateLive, | 22 | updateLive, |
23 | uploadVideoAndGetId, | 23 | uploadVideoAndGetId, |
24 | userLogin, | 24 | userLogin, |
25 | waitUntilLiveStarts | 25 | waitUntilLivePublished |
26 | } from '../../../../shared/extra-utils' | 26 | } from '../../../../shared/extra-utils' |
27 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 27 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
28 | 28 | ||
@@ -409,7 +409,7 @@ describe('Test video lives API validator', function () { | |||
409 | 409 | ||
410 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) | 410 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) |
411 | 411 | ||
412 | await waitUntilLiveStarts(server.url, server.accessToken, videoId) | 412 | await waitUntilLivePublished(server.url, server.accessToken, videoId) |
413 | await updateLive(server.url, server.accessToken, videoId, {}, HttpStatusCode.BAD_REQUEST_400) | 413 | await updateLive(server.url, server.accessToken, videoId, {}, HttpStatusCode.BAD_REQUEST_400) |
414 | 414 | ||
415 | await stopFfmpeg(command) | 415 | await stopFfmpeg(command) |
@@ -423,7 +423,7 @@ describe('Test video lives API validator', function () { | |||
423 | 423 | ||
424 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) | 424 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) |
425 | 425 | ||
426 | await waitUntilLiveStarts(server.url, server.accessToken, videoId) | 426 | await waitUntilLivePublished(server.url, server.accessToken, videoId) |
427 | 427 | ||
428 | await runAndTestFfmpegStreamError(server.url, server.accessToken, videoId, true) | 428 | await runAndTestFfmpegStreamError(server.url, server.accessToken, videoId, true) |
429 | 429 | ||
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index 54e4010e9..2701c65e3 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -20,7 +20,7 @@ import { | |||
20 | updateLive, | 20 | updateLive, |
21 | wait, | 21 | wait, |
22 | waitJobs, | 22 | waitJobs, |
23 | waitUntilLiveStarts | 23 | waitUntilLivePublished |
24 | } from '../../../../shared/extra-utils' | 24 | } from '../../../../shared/extra-utils' |
25 | 25 | ||
26 | const expect = chai.expect | 26 | const expect = chai.expect |
@@ -116,7 +116,7 @@ describe('Permenant live', function () { | |||
116 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) | 116 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) |
117 | 117 | ||
118 | for (const server of servers) { | 118 | for (const server of servers) { |
119 | await waitUntilLiveStarts(server.url, server.accessToken, videoUUID) | 119 | await waitUntilLivePublished(server.url, server.accessToken, videoUUID) |
120 | } | 120 | } |
121 | 121 | ||
122 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 122 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
@@ -171,7 +171,7 @@ describe('Permenant live', function () { | |||
171 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) | 171 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) |
172 | 172 | ||
173 | for (const server of servers) { | 173 | for (const server of servers) { |
174 | await waitUntilLiveStarts(server.url, server.accessToken, videoUUID) | 174 | await waitUntilLivePublished(server.url, server.accessToken, videoUUID) |
175 | } | 175 | } |
176 | 176 | ||
177 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 177 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index e300ec345..bd683b2bf 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts | |||
@@ -23,7 +23,7 @@ import { | |||
23 | updateCustomSubConfig, | 23 | updateCustomSubConfig, |
24 | updateVideo, | 24 | updateVideo, |
25 | waitJobs, | 25 | waitJobs, |
26 | waitUntilLiveStarts | 26 | waitUntilLivePublished |
27 | } from '../../../../shared/extra-utils' | 27 | } from '../../../../shared/extra-utils' |
28 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 28 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
29 | 29 | ||
@@ -127,7 +127,7 @@ describe('Save replay setting', function () { | |||
127 | this.timeout(20000) | 127 | this.timeout(20000) |
128 | 128 | ||
129 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 129 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
130 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 130 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
131 | 131 | ||
132 | await waitJobs(servers) | 132 | await waitJobs(servers) |
133 | 133 | ||
@@ -156,7 +156,7 @@ describe('Save replay setting', function () { | |||
156 | liveVideoUUID = await createLiveWrapper(false) | 156 | liveVideoUUID = await createLiveWrapper(false) |
157 | 157 | ||
158 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 158 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
159 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 159 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
160 | 160 | ||
161 | await waitJobs(servers) | 161 | await waitJobs(servers) |
162 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) | 162 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) |
@@ -182,7 +182,7 @@ describe('Save replay setting', function () { | |||
182 | liveVideoUUID = await createLiveWrapper(false) | 182 | liveVideoUUID = await createLiveWrapper(false) |
183 | 183 | ||
184 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 184 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
185 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 185 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
186 | 186 | ||
187 | await waitJobs(servers) | 187 | await waitJobs(servers) |
188 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) | 188 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) |
@@ -216,7 +216,7 @@ describe('Save replay setting', function () { | |||
216 | this.timeout(20000) | 216 | this.timeout(20000) |
217 | 217 | ||
218 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 218 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
219 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 219 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
220 | 220 | ||
221 | await waitJobs(servers) | 221 | await waitJobs(servers) |
222 | 222 | ||
@@ -259,7 +259,7 @@ describe('Save replay setting', function () { | |||
259 | liveVideoUUID = await createLiveWrapper(true) | 259 | liveVideoUUID = await createLiveWrapper(true) |
260 | 260 | ||
261 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 261 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
262 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 262 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
263 | 263 | ||
264 | await waitJobs(servers) | 264 | await waitJobs(servers) |
265 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) | 265 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) |
@@ -285,7 +285,7 @@ describe('Save replay setting', function () { | |||
285 | liveVideoUUID = await createLiveWrapper(true) | 285 | liveVideoUUID = await createLiveWrapper(true) |
286 | 286 | ||
287 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 287 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
288 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 288 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
289 | 289 | ||
290 | await waitJobs(servers) | 290 | await waitJobs(servers) |
291 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) | 291 | await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index a74988aba..7ea0ec198 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -7,6 +7,7 @@ import { join } from 'path' | |||
7 | import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' | 7 | import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' |
8 | import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io' | 8 | import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io' |
9 | import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' | 9 | import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' |
10 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
10 | import { | 11 | import { |
11 | addVideoToBlacklist, | 12 | addVideoToBlacklist, |
12 | buildServerDirectory, | 13 | buildServerDirectory, |
@@ -41,10 +42,9 @@ import { | |||
41 | waitJobs, | 42 | waitJobs, |
42 | waitUntilLiveEnded, | 43 | waitUntilLiveEnded, |
43 | waitUntilLivePublished, | 44 | waitUntilLivePublished, |
44 | waitUntilLiveStarts, | 45 | waitUntilLiveSegmentGeneration, |
45 | waitUntilLog | 46 | waitUntilLog |
46 | } from '../../../../shared/extra-utils' | 47 | } from '../../../../shared/extra-utils' |
47 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
48 | 48 | ||
49 | const expect = chai.expect | 49 | const expect = chai.expect |
50 | 50 | ||
@@ -329,8 +329,9 @@ describe('Test live', function () { | |||
329 | await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) | 329 | await checkResolutionsInMasterPlaylist(hlsPlaylist.playlistUrl, resolutions) |
330 | 330 | ||
331 | for (let i = 0; i < resolutions.length; i++) { | 331 | for (let i = 0; i < resolutions.length; i++) { |
332 | const segmentName = `${i}-000001.ts` | 332 | const segmentNum = 1 |
333 | await waitUntilLog(servers[0], `${video.uuid}/${segmentName}`, 2, false) | 333 | const segmentName = `${i}-00000${segmentNum}.ts` |
334 | await waitUntilLiveSegmentGeneration(servers[0], video.uuid, i, segmentNum) | ||
334 | 335 | ||
335 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) | 336 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) |
336 | const subPlaylist = res.text | 337 | const subPlaylist = res.text |
@@ -374,7 +375,7 @@ describe('Test live', function () { | |||
374 | liveVideoId = await createLiveWrapper(false) | 375 | liveVideoId = await createLiveWrapper(false) |
375 | 376 | ||
376 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 377 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
377 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId) | 378 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) |
378 | await waitJobs(servers) | 379 | await waitJobs(servers) |
379 | 380 | ||
380 | await testVideoResolutions(liveVideoId, [ 720 ]) | 381 | await testVideoResolutions(liveVideoId, [ 720 ]) |
@@ -390,7 +391,7 @@ describe('Test live', function () { | |||
390 | liveVideoId = await createLiveWrapper(false) | 391 | liveVideoId = await createLiveWrapper(false) |
391 | 392 | ||
392 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 393 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
393 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId) | 394 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) |
394 | await waitJobs(servers) | 395 | await waitJobs(servers) |
395 | 396 | ||
396 | await testVideoResolutions(liveVideoId, resolutions) | 397 | await testVideoResolutions(liveVideoId, resolutions) |
@@ -407,7 +408,7 @@ describe('Test live', function () { | |||
407 | liveVideoId = await createLiveWrapper(true) | 408 | liveVideoId = await createLiveWrapper(true) |
408 | 409 | ||
409 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') | 410 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') |
410 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId) | 411 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) |
411 | await waitJobs(servers) | 412 | await waitJobs(servers) |
412 | 413 | ||
413 | await testVideoResolutions(liveVideoId, resolutions) | 414 | await testVideoResolutions(liveVideoId, resolutions) |
@@ -495,7 +496,7 @@ describe('Test live', function () { | |||
495 | liveVideoId = res.body.video.uuid | 496 | liveVideoId = res.body.video.uuid |
496 | 497 | ||
497 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 498 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
498 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId) | 499 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) |
499 | await waitJobs(servers) | 500 | await waitJobs(servers) |
500 | }) | 501 | }) |
501 | 502 | ||
@@ -584,7 +585,7 @@ describe('Test live', function () { | |||
584 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 585 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
585 | 586 | ||
586 | for (const server of servers) { | 587 | for (const server of servers) { |
587 | await waitUntilLiveStarts(server.url, server.accessToken, liveVideoUUID) | 588 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID) |
588 | } | 589 | } |
589 | 590 | ||
590 | await waitJobs(servers) | 591 | await waitJobs(servers) |
@@ -623,7 +624,7 @@ describe('Test live', function () { | |||
623 | socket.emit('subscribe', { videoId }) | 624 | socket.emit('subscribe', { videoId }) |
624 | 625 | ||
625 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 626 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
626 | await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) | 627 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) |
627 | await waitJobs(servers) | 628 | await waitJobs(servers) |
628 | 629 | ||
629 | expect(stateChanges).to.have.lengthOf(1) | 630 | expect(stateChanges).to.have.lengthOf(1) |
@@ -653,7 +654,7 @@ describe('Test live', function () { | |||
653 | } | 654 | } |
654 | 655 | ||
655 | before(async function () { | 656 | before(async function () { |
656 | this.timeout(60000) | 657 | this.timeout(120000) |
657 | 658 | ||
658 | liveVideoId = await createLiveWrapper(false) | 659 | liveVideoId = await createLiveWrapper(false) |
659 | liveVideoReplayId = await createLiveWrapper(true) | 660 | liveVideoReplayId = await createLiveWrapper(true) |
@@ -664,10 +665,13 @@ describe('Test live', function () { | |||
664 | ]) | 665 | ]) |
665 | 666 | ||
666 | await Promise.all([ | 667 | await Promise.all([ |
667 | waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoId), | 668 | waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId), |
668 | waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoReplayId) | 669 | waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoReplayId) |
669 | ]) | 670 | ]) |
670 | 671 | ||
672 | await waitUntilLiveSegmentGeneration(servers[0], liveVideoId, 0, 2) | ||
673 | await waitUntilLiveSegmentGeneration(servers[0], liveVideoReplayId, 0, 2) | ||
674 | |||
671 | await killallServers([ servers[0] ]) | 675 | await killallServers([ servers[0] ]) |
672 | await reRunServer(servers[0]) | 676 | await reRunServer(servers[0]) |
673 | 677 | ||
@@ -677,14 +681,11 @@ describe('Test live', function () { | |||
677 | it('Should cleanup lives', async function () { | 681 | it('Should cleanup lives', async function () { |
678 | this.timeout(60000) | 682 | this.timeout(60000) |
679 | 683 | ||
680 | const res = await getVideo(servers[0].url, liveVideoId) | 684 | await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId) |
681 | const video: VideoDetails = res.body | ||
682 | |||
683 | expect(video.state.id).to.equal(VideoState.LIVE_ENDED) | ||
684 | }) | 685 | }) |
685 | 686 | ||
686 | it('Should save a live replay', async function () { | 687 | it('Should save a live replay', async function () { |
687 | this.timeout(60000) | 688 | this.timeout(120000) |
688 | 689 | ||
689 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoReplayId) | 690 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoReplayId) |
690 | }) | 691 | }) |