aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-03 11:38:07 +0200
committerChocobozzz <me@florianbigard.com>2022-05-03 14:49:15 +0200
commit26e3e98ff0e222a9fb9226938ac6902af77921bd (patch)
tree73d1c6f2524e380862d3365f12043fc319d40841 /server/tests/api
parent86c5229b4d726202378ef46854383bcafca22310 (diff)
downloadPeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.gz
PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.zst
PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.zip
Support live session in server
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/live.ts46
-rw-r--r--server/tests/api/live/live-constraints.ts52
-rw-r--r--server/tests/api/live/live-permanent.ts17
-rw-r--r--server/tests/api/live/live-save-replay.ts72
-rw-r--r--server/tests/api/live/live.ts8
-rw-r--r--server/tests/api/notifications/user-notifications.ts76
6 files changed, 257 insertions, 14 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index bbd331657..29f847e51 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -388,6 +388,52 @@ describe('Test video lives API validator', function () {
388 }) 388 })
389 }) 389 })
390 390
391 describe('When getting live sessions', function () {
392
393 it('Should fail with a bad access token', async function () {
394 await command.listSessions({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
395 })
396
397 it('Should fail without token', async function () {
398 await command.listSessions({ token: null, videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
399 })
400
401 it('Should fail with the token of another user', async function () {
402 await command.listSessions({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
403 })
404
405 it('Should fail with a bad video id', async function () {
406 await command.listSessions({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
407 })
408
409 it('Should fail with an unknown video id', async function () {
410 await command.listSessions({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
411 })
412
413 it('Should fail with a non live video', async function () {
414 await command.listSessions({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
415 })
416
417 it('Should succeed with the correct params', async function () {
418 await command.listSessions({ videoId: video.id })
419 })
420 })
421
422 describe('When getting live session of a replay', function () {
423
424 it('Should fail with a bad video id', async function () {
425 await command.getReplaySession({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
426 })
427
428 it('Should fail with an unknown video id', async function () {
429 await command.getReplaySession({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
430 })
431
432 it('Should fail with a non replay video', async function () {
433 await command.getReplaySession({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
434 })
435 })
436
391 describe('When updating live information', async function () { 437 describe('When updating live information', async function () {
392 438
393 it('Should fail without access token', async function () { 439 it('Should fail without access token', async function () {
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index b92dc7b89..b81973395 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -3,7 +3,7 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { wait } from '@shared/core-utils' 5import { wait } from '@shared/core-utils'
6import { VideoPrivacy } from '@shared/models' 6import { LiveVideoError, VideoPrivacy } from '@shared/models'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
@@ -12,7 +12,8 @@ import {
12 PeerTubeServer, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 waitJobs 15 waitJobs,
16 waitUntilLiveWaitingOnAllServers
16} from '@shared/server-commands' 17} from '@shared/server-commands'
17import { checkLiveCleanup } from '../../shared' 18import { checkLiveCleanup } from '../../shared'
18 19
@@ -24,12 +25,18 @@ describe('Test live constraints', function () {
24 let userAccessToken: string 25 let userAccessToken: string
25 let userChannelId: number 26 let userChannelId: number
26 27
27 async function createLiveWrapper (saveReplay: boolean) { 28 async function createLiveWrapper (options: {
29 replay: boolean
30 permanent: boolean
31 }) {
32 const { replay, permanent } = options
33
28 const liveAttributes = { 34 const liveAttributes = {
29 name: 'user live', 35 name: 'user live',
30 channelId: userChannelId, 36 channelId: userChannelId,
31 privacy: VideoPrivacy.PUBLIC, 37 privacy: VideoPrivacy.PUBLIC,
32 saveReplay 38 saveReplay: replay,
39 permanentLive: permanent
33 } 40 }
34 41
35 const { uuid } = await servers[0].live.create({ token: userAccessToken, fields: liveAttributes }) 42 const { uuid } = await servers[0].live.create({ token: userAccessToken, fields: liveAttributes })
@@ -97,23 +104,42 @@ describe('Test live constraints', function () {
97 it('Should not have size limit if save replay is disabled', async function () { 104 it('Should not have size limit if save replay is disabled', async function () {
98 this.timeout(60000) 105 this.timeout(60000)
99 106
100 const userVideoLiveoId = await createLiveWrapper(false) 107 const userVideoLiveoId = await createLiveWrapper({ replay: false, permanent: false })
101 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) 108 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
102 }) 109 })
103 110
104 it('Should have size limit depending on user global quota if save replay is enabled', async function () { 111 it('Should have size limit depending on user global quota if save replay is enabled on non permanent live', async function () {
105 this.timeout(60000) 112 this.timeout(60000)
106 113
107 // Wait for user quota memoize cache invalidation 114 // Wait for user quota memoize cache invalidation
108 await wait(5000) 115 await wait(5000)
109 116
110 const userVideoLiveoId = await createLiveWrapper(true) 117 const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: false })
111 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 118 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
112 119
113 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 120 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
114 await waitJobs(servers) 121 await waitJobs(servers)
115 122
116 await checkSaveReplay(userVideoLiveoId) 123 await checkSaveReplay(userVideoLiveoId)
124
125 const session = await servers[0].live.getReplaySession({ videoId: userVideoLiveoId })
126 expect(session.error).to.equal(LiveVideoError.QUOTA_EXCEEDED)
127 })
128
129 it('Should have size limit depending on user global quota if save replay is enabled on a permanent live', async function () {
130 this.timeout(60000)
131
132 // Wait for user quota memoize cache invalidation
133 await wait(5000)
134
135 const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: true })
136 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
137
138 await waitJobs(servers)
139 await waitUntilLiveWaitingOnAllServers(servers, userVideoLiveoId)
140
141 const session = await servers[0].live.findLatestSession({ videoId: userVideoLiveoId })
142 expect(session.error).to.equal(LiveVideoError.QUOTA_EXCEEDED)
117 }) 143 })
118 144
119 it('Should have size limit depending on user daily quota if save replay is enabled', async function () { 145 it('Should have size limit depending on user daily quota if save replay is enabled', async function () {
@@ -124,13 +150,16 @@ describe('Test live constraints', function () {
124 150
125 await updateQuota({ total: -1, daily: 1 }) 151 await updateQuota({ total: -1, daily: 1 })
126 152
127 const userVideoLiveoId = await createLiveWrapper(true) 153 const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: false })
128 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 154 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
129 155
130 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 156 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
131 await waitJobs(servers) 157 await waitJobs(servers)
132 158
133 await checkSaveReplay(userVideoLiveoId) 159 await checkSaveReplay(userVideoLiveoId)
160
161 const session = await servers[0].live.getReplaySession({ videoId: userVideoLiveoId })
162 expect(session.error).to.equal(LiveVideoError.QUOTA_EXCEEDED)
134 }) 163 })
135 164
136 it('Should succeed without quota limit', async function () { 165 it('Should succeed without quota limit', async function () {
@@ -141,7 +170,7 @@ describe('Test live constraints', function () {
141 170
142 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) 171 await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })
143 172
144 const userVideoLiveoId = await createLiveWrapper(true) 173 const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: false })
145 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) 174 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
146 }) 175 })
147 176
@@ -162,13 +191,16 @@ describe('Test live constraints', function () {
162 } 191 }
163 }) 192 })
164 193
165 const userVideoLiveoId = await createLiveWrapper(true) 194 const userVideoLiveoId = await createLiveWrapper({ replay: true, permanent: false })
166 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) 195 await servers[0].live.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
167 196
168 await waitUntilLivePublishedOnAllServers(userVideoLiveoId) 197 await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
169 await waitJobs(servers) 198 await waitJobs(servers)
170 199
171 await checkSaveReplay(userVideoLiveoId, [ 720, 480, 360, 240, 144 ]) 200 await checkSaveReplay(userVideoLiveoId, [ 720, 480, 360, 240, 144 ])
201
202 const session = await servers[0].live.getReplaySession({ videoId: userVideoLiveoId })
203 expect(session.error).to.equal(LiveVideoError.DURATION_EXCEEDED)
172 }) 204 })
173 205
174 after(async function () { 206 after(async function () {
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index a88d71dd9..92eac9e5f 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -172,6 +172,23 @@ describe('Permanent live', function () {
172 await stopFfmpeg(ffmpegCommand) 172 await stopFfmpeg(ffmpegCommand)
173 }) 173 })
174 174
175 it('Should have appropriate sessions', async function () {
176 this.timeout(60000)
177
178 await servers[0].live.waitUntilWaiting({ videoId: videoUUID })
179
180 const { data, total } = await servers[0].live.listSessions({ videoId: videoUUID })
181 expect(total).to.equal(2)
182 expect(data).to.have.lengthOf(2)
183
184 for (const session of data) {
185 expect(session.startDate).to.exist
186 expect(session.endDate).to.exist
187
188 expect(session.error).to.not.exist
189 }
190 })
191
175 after(async function () { 192 after(async function () {
176 await cleanupTests(servers) 193 await cleanupTests(servers)
177 }) 194 })
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index fc6acc624..7ddcb04ef 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -5,7 +5,7 @@ import * as chai from 'chai'
5import { FfmpegCommand } from 'fluent-ffmpeg' 5import { FfmpegCommand } from 'fluent-ffmpeg'
6import { checkLiveCleanup } from '@server/tests/shared' 6import { checkLiveCleanup } from '@server/tests/shared'
7import { wait } from '@shared/core-utils' 7import { wait } from '@shared/core-utils'
8import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' 8import { HttpStatusCode, LiveVideoCreate, LiveVideoError, VideoPrivacy, VideoState } from '@shared/models'
9import { 9import {
10 cleanupTests, 10 cleanupTests,
11 ConfigCommand, 11 ConfigCommand,
@@ -143,6 +143,9 @@ describe('Save replay setting', function () {
143 }) 143 })
144 144
145 describe('With save replay disabled', function () { 145 describe('With save replay disabled', function () {
146 let sessionStartDateMin: Date
147 let sessionStartDateMax: Date
148 let sessionEndDateMin: Date
146 149
147 it('Should correctly create and federate the "waiting for stream" live', async function () { 150 it('Should correctly create and federate the "waiting for stream" live', async function () {
148 this.timeout(20000) 151 this.timeout(20000)
@@ -160,7 +163,9 @@ describe('Save replay setting', function () {
160 163
161 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) 164 ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoUUID })
162 165
166 sessionStartDateMin = new Date()
163 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) 167 await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
168 sessionStartDateMax = new Date()
164 169
165 await waitJobs(servers) 170 await waitJobs(servers)
166 171
@@ -171,6 +176,7 @@ describe('Save replay setting', function () {
171 it('Should correctly delete the video files after the stream ended', async function () { 176 it('Should correctly delete the video files after the stream ended', async function () {
172 this.timeout(40000) 177 this.timeout(40000)
173 178
179 sessionEndDateMin = new Date()
174 await stopFfmpeg(ffmpegCommand) 180 await stopFfmpeg(ffmpegCommand)
175 181
176 for (const server of servers) { 182 for (const server of servers) {
@@ -186,6 +192,24 @@ describe('Save replay setting', function () {
186 await checkLiveCleanup(servers[0], liveVideoUUID, []) 192 await checkLiveCleanup(servers[0], liveVideoUUID, [])
187 }) 193 })
188 194
195 it('Should have appropriate ended session', async function () {
196 const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID })
197 expect(total).to.equal(1)
198 expect(data).to.have.lengthOf(1)
199
200 const session = data[0]
201
202 const startDate = new Date(session.startDate)
203 expect(startDate).to.be.above(sessionStartDateMin)
204 expect(startDate).to.be.below(sessionStartDateMax)
205
206 expect(session.endDate).to.exist
207 expect(new Date(session.endDate)).to.be.above(sessionEndDateMin)
208
209 expect(session.error).to.not.exist
210 expect(session.replayVideo).to.not.exist
211 })
212
189 it('Should correctly terminate the stream on blacklist and delete the live', async function () { 213 it('Should correctly terminate the stream on blacklist and delete the live', async function () {
190 this.timeout(40000) 214 this.timeout(40000)
191 215
@@ -201,6 +225,15 @@ describe('Save replay setting', function () {
201 await checkLiveCleanup(servers[0], liveVideoUUID, []) 225 await checkLiveCleanup(servers[0], liveVideoUUID, [])
202 }) 226 })
203 227
228 it('Should have blacklisted session error', async function () {
229 const session = await servers[0].live.findLatestSession({ videoId: liveVideoUUID })
230 expect(session.startDate).to.exist
231 expect(session.endDate).to.exist
232
233 expect(session.error).to.equal(LiveVideoError.BLACKLISTED)
234 expect(session.replayVideo).to.not.exist
235 })
236
204 it('Should correctly terminate the stream on delete and delete the video', async function () { 237 it('Should correctly terminate the stream on delete and delete the video', async function () {
205 this.timeout(40000) 238 this.timeout(40000)
206 239
@@ -249,6 +282,22 @@ describe('Save replay setting', function () {
249 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) 282 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
250 }) 283 })
251 284
285 it('Should find the replay live session', async function () {
286 const session = await servers[0].live.getReplaySession({ videoId: liveVideoUUID })
287
288 expect(session).to.exist
289
290 expect(session.startDate).to.exist
291 expect(session.endDate).to.exist
292
293 expect(session.error).to.not.exist
294
295 expect(session.replayVideo).to.exist
296 expect(session.replayVideo.id).to.exist
297 expect(session.replayVideo.shortUUID).to.exist
298 expect(session.replayVideo.uuid).to.equal(liveVideoUUID)
299 })
300
252 it('Should update the saved live and correctly federate the updated attributes', async function () { 301 it('Should update the saved live and correctly federate the updated attributes', async function () {
253 this.timeout(30000) 302 this.timeout(30000)
254 303
@@ -337,6 +386,27 @@ describe('Save replay setting', function () {
337 lastReplayUUID = video.uuid 386 lastReplayUUID = video.uuid
338 }) 387 })
339 388
389 it('Should have appropriate ended session and replay live session', async function () {
390 const { data, total } = await servers[0].live.listSessions({ videoId: liveVideoUUID })
391 expect(total).to.equal(1)
392 expect(data).to.have.lengthOf(1)
393
394 const sessionFromLive = data[0]
395 const sessionFromReplay = await servers[0].live.getReplaySession({ videoId: lastReplayUUID })
396
397 for (const session of [ sessionFromLive, sessionFromReplay ]) {
398 expect(session.startDate).to.exist
399 expect(session.endDate).to.exist
400
401 expect(session.error).to.not.exist
402
403 expect(session.replayVideo).to.exist
404 expect(session.replayVideo.id).to.exist
405 expect(session.replayVideo.shortUUID).to.exist
406 expect(session.replayVideo.uuid).to.equal(lastReplayUUID)
407 }
408 })
409
340 it('Should have cleaned up the live files', async function () { 410 it('Should have cleaned up the live files', async function () {
341 await checkLiveCleanup(servers[0], liveVideoUUID, []) 411 await checkLiveCleanup(servers[0], liveVideoUUID, [])
342 }) 412 })
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index ab7251e31..9b8fbe3e2 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -594,6 +594,8 @@ describe('Test live', function () {
594 594
595 let permanentLiveReplayName: string 595 let permanentLiveReplayName: string
596 596
597 let beforeServerRestart: Date
598
597 async function createLiveWrapper (options: { saveReplay: boolean, permanent: boolean }) { 599 async function createLiveWrapper (options: { saveReplay: boolean, permanent: boolean }) {
598 const liveAttributes: LiveVideoCreate = { 600 const liveAttributes: LiveVideoCreate = {
599 name: 'live video', 601 name: 'live video',
@@ -636,6 +638,8 @@ describe('Test live', function () {
636 } 638 }
637 639
638 await killallServers([ servers[0] ]) 640 await killallServers([ servers[0] ])
641
642 beforeServerRestart = new Date()
639 await servers[0].run() 643 await servers[0].run()
640 644
641 await wait(5000) 645 await wait(5000)
@@ -653,6 +657,10 @@ describe('Test live', function () {
653 this.timeout(120000) 657 this.timeout(120000)
654 658
655 await commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) 659 await commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
660
661 const session = await commands[0].getReplaySession({ videoId: liveVideoReplayId })
662 expect(session.endDate).to.exist
663 expect(new Date(session.endDate)).to.be.above(beforeServerRestart)
656 }) 664 })
657 665
658 it('Should have saved a permanent live replay', async function () { 666 it('Should have saved a permanent live replay', async function () {
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 47e85a30c..1705fda55 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -7,8 +7,8 @@ import {
7 checkMyVideoImportIsFinished, 7 checkMyVideoImportIsFinished,
8 checkNewActorFollow, 8 checkNewActorFollow,
9 checkNewVideoFromSubscription, 9 checkNewVideoFromSubscription,
10 checkVideoStudioEditionIsFinished,
11 checkVideoIsPublished, 10 checkVideoIsPublished,
11 checkVideoStudioEditionIsFinished,
12 FIXTURE_URLS, 12 FIXTURE_URLS,
13 MockSmtpServer, 13 MockSmtpServer,
14 prepareNotificationsTest, 14 prepareNotificationsTest,
@@ -16,8 +16,8 @@ import {
16} from '@server/tests/shared' 16} from '@server/tests/shared'
17import { wait } from '@shared/core-utils' 17import { wait } from '@shared/core-utils'
18import { buildUUID } from '@shared/extra-utils' 18import { buildUUID } from '@shared/extra-utils'
19import { UserNotification, UserNotificationType, VideoStudioTask, VideoPrivacy } from '@shared/models' 19import { UserNotification, UserNotificationType, VideoPrivacy, VideoStudioTask } from '@shared/models'
20import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' 20import { cleanupTests, findExternalSavedVideo, PeerTubeServer, stopFfmpeg, waitJobs } from '@shared/server-commands'
21 21
22const expect = chai.expect 22const expect = chai.expect
23 23
@@ -323,6 +323,76 @@ describe('Test user notifications', function () {
323 }) 323 })
324 }) 324 })
325 325
326 describe('My live replay is published', function () {
327
328 let baseParams: CheckerBaseParams
329
330 before(() => {
331 baseParams = {
332 server: servers[1],
333 emails,
334 socketNotifications: adminNotificationsServer2,
335 token: servers[1].accessToken
336 }
337 })
338
339 it('Should send a notification is a live replay of a non permanent live is published', async function () {
340 this.timeout(120000)
341
342 const { shortUUID } = await servers[1].live.create({
343 fields: {
344 name: 'non permanent live',
345 privacy: VideoPrivacy.PUBLIC,
346 channelId: servers[1].store.channel.id,
347 saveReplay: true,
348 permanentLive: false
349 }
350 })
351
352 const ffmpegCommand = await servers[1].live.sendRTMPStreamInVideo({ videoId: shortUUID })
353
354 await waitJobs(servers)
355 await servers[1].live.waitUntilPublished({ videoId: shortUUID })
356
357 await stopFfmpeg(ffmpegCommand)
358 await servers[1].live.waitUntilReplacedByReplay({ videoId: shortUUID })
359
360 await waitJobs(servers)
361 await checkVideoIsPublished({ ...baseParams, videoName: 'non permanent live', shortUUID, checkType: 'presence' })
362 })
363
364 it('Should send a notification is a live replay of a permanent live is published', async function () {
365 this.timeout(120000)
366
367 const { shortUUID } = await servers[1].live.create({
368 fields: {
369 name: 'permanent live',
370 privacy: VideoPrivacy.PUBLIC,
371 channelId: servers[1].store.channel.id,
372 saveReplay: true,
373 permanentLive: true
374 }
375 })
376
377 const ffmpegCommand = await servers[1].live.sendRTMPStreamInVideo({ videoId: shortUUID })
378
379 await waitJobs(servers)
380 await servers[1].live.waitUntilPublished({ videoId: shortUUID })
381
382 const liveDetails = await servers[1].videos.get({ id: shortUUID })
383
384 await stopFfmpeg(ffmpegCommand)
385
386 await servers[1].live.waitUntilWaiting({ videoId: shortUUID })
387 await waitJobs(servers)
388
389 const video = await findExternalSavedVideo(servers[1], liveDetails)
390 expect(video).to.exist
391
392 await checkVideoIsPublished({ ...baseParams, videoName: video.name, shortUUID: video.shortUUID, checkType: 'presence' })
393 })
394 })
395
326 describe('Video studio', function () { 396 describe('Video studio', function () {
327 let baseParams: CheckerBaseParams 397 let baseParams: CheckerBaseParams
328 398