aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-22 09:50:20 +0200
committerChocobozzz <me@florianbigard.com>2022-05-03 08:32:20 +0200
commit98ebfa39500ce9dfbb782e43c4d269f9a2989698 (patch)
tree8ef016f780601ddfca8f907d2a18efb2d91d3ec9 /server/tests/api/live/live.ts
parentc74cd9feaba583fc40c61d1c3a7c036267a56ea1 (diff)
downloadPeerTube-98ebfa39500ce9dfbb782e43c4d269f9a2989698.tar.gz
PeerTube-98ebfa39500ce9dfbb782e43c4d269f9a2989698.tar.zst
PeerTube-98ebfa39500ce9dfbb782e43c4d269f9a2989698.zip
Fix getting live by anonymous user
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r--server/tests/api/live/live.ts36
1 files changed, 29 insertions, 7 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index b8c4c1e29..ab7251e31 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -590,13 +590,17 @@ describe('Test live', function () {
590 describe('After a server restart', function () { 590 describe('After a server restart', function () {
591 let liveVideoId: string 591 let liveVideoId: string
592 let liveVideoReplayId: string 592 let liveVideoReplayId: string
593 let permanentLiveVideoReplayId: string
593 594
594 async function createLiveWrapper (saveReplay: boolean) { 595 let permanentLiveReplayName: string
595 const liveAttributes = { 596
597 async function createLiveWrapper (options: { saveReplay: boolean, permanent: boolean }) {
598 const liveAttributes: LiveVideoCreate = {
596 name: 'live video', 599 name: 'live video',
597 channelId: servers[0].store.channel.id, 600 channelId: servers[0].store.channel.id,
598 privacy: VideoPrivacy.PUBLIC, 601 privacy: VideoPrivacy.PUBLIC,
599 saveReplay 602 saveReplay: options.saveReplay,
603 permanentLive: options.permanent
600 } 604 }
601 605
602 const { uuid } = await commands[0].create({ fields: liveAttributes }) 606 const { uuid } = await commands[0].create({ fields: liveAttributes })
@@ -604,41 +608,59 @@ describe('Test live', function () {
604 } 608 }
605 609
606 before(async function () { 610 before(async function () {
607 this.timeout(120000) 611 this.timeout(160000)
608 612
609 liveVideoId = await createLiveWrapper(false) 613 liveVideoId = await createLiveWrapper({ saveReplay: false, permanent: false })
610 liveVideoReplayId = await createLiveWrapper(true) 614 liveVideoReplayId = await createLiveWrapper({ saveReplay: true, permanent: false })
615 permanentLiveVideoReplayId = await createLiveWrapper({ saveReplay: true, permanent: true })
611 616
612 await Promise.all([ 617 await Promise.all([
613 commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId }), 618 commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId }),
619 commands[0].sendRTMPStreamInVideo({ videoId: permanentLiveVideoReplayId }),
614 commands[0].sendRTMPStreamInVideo({ videoId: liveVideoReplayId }) 620 commands[0].sendRTMPStreamInVideo({ videoId: liveVideoReplayId })
615 ]) 621 ])
616 622
617 await Promise.all([ 623 await Promise.all([
618 commands[0].waitUntilPublished({ videoId: liveVideoId }), 624 commands[0].waitUntilPublished({ videoId: liveVideoId }),
625 commands[0].waitUntilPublished({ videoId: permanentLiveVideoReplayId }),
619 commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) 626 commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
620 ]) 627 ])
621 628
622 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) 629 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 })
623 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) 630 await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
631 await commands[0].waitUntilSegmentGeneration({ videoUUID: permanentLiveVideoReplayId, resolution: 0, segment: 2 })
632
633 {
634 const video = await servers[0].videos.get({ id: permanentLiveVideoReplayId })
635 permanentLiveReplayName = video.name + ' - ' + new Date(video.publishedAt).toLocaleString()
636 }
624 637
625 await killallServers([ servers[0] ]) 638 await killallServers([ servers[0] ])
626 await servers[0].run() 639 await servers[0].run()
627 640
628 await wait(5000) 641 await wait(5000)
642 await waitJobs(servers)
629 }) 643 })
630 644
631 it('Should cleanup lives', async function () { 645 it('Should cleanup lives', async function () {
632 this.timeout(60000) 646 this.timeout(60000)
633 647
634 await commands[0].waitUntilEnded({ videoId: liveVideoId }) 648 await commands[0].waitUntilEnded({ videoId: liveVideoId })
649 await commands[0].waitUntilWaiting({ videoId: permanentLiveVideoReplayId })
635 }) 650 })
636 651
637 it('Should save a live replay', async function () { 652 it('Should save a non permanent live replay', async function () {
638 this.timeout(120000) 653 this.timeout(120000)
639 654
640 await commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) 655 await commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
641 }) 656 })
657
658 it('Should have saved a permanent live replay', async function () {
659 this.timeout(120000)
660
661 const { data } = await servers[0].videos.listMyVideos({ sort: '-publishedAt' })
662 expect(data.find(v => v.name === permanentLiveReplayName)).to.exist
663 })
642 }) 664 })
643 665
644 after(async function () { 666 after(async function () {