aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r--server/tests/api/live/live.ts37
1 files changed, 19 insertions, 18 deletions
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'
7import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' 7import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
8import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io' 8import { getLiveNotificationSocket } from '@shared/extra-utils/socket/socket-io'
9import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' 9import { LiveVideo, LiveVideoCreate, Video, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
10import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
10import { 11import {
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'
47import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
48 48
49const expect = chai.expect 49const 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 })