diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/api/check-params/live.ts | 72 | ||||
-rw-r--r-- | server/tests/api/live/live-constraints.ts | 21 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 43 | ||||
-rw-r--r-- | server/tests/api/live/live-save-replay.ts | 29 | ||||
-rw-r--r-- | server/tests/api/live/live-socket-messages.ts | 19 | ||||
-rw-r--r-- | server/tests/api/live/live-views.ts | 8 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 90 | ||||
-rw-r--r-- | server/tests/api/search/search-videos.ts | 22 | ||||
-rw-r--r-- | server/tests/api/videos/video-change-ownership.ts | 5 | ||||
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 3 | ||||
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 3 | ||||
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 28 |
12 files changed, 155 insertions, 188 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 7a623c169..56116848f 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -2,27 +2,24 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { LiveVideo, VideoCreateResult, VideoPrivacy } from '@shared/models' | 5 | import { VideoCreateResult, VideoPrivacy } from '@shared/models' |
6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createUser, | 10 | createUser, |
11 | flushAndRunServer, | 11 | flushAndRunServer, |
12 | getLive, | ||
13 | getMyUserInformation, | 12 | getMyUserInformation, |
14 | immutableAssign, | 13 | immutableAssign, |
14 | LiveCommand, | ||
15 | makePostBodyRequest, | 15 | makePostBodyRequest, |
16 | makeUploadRequest, | 16 | makeUploadRequest, |
17 | runAndTestFfmpegStreamError, | ||
18 | sendRTMPStream, | 17 | sendRTMPStream, |
19 | ServerInfo, | 18 | ServerInfo, |
20 | setAccessTokensToServers, | 19 | setAccessTokensToServers, |
21 | stopFfmpeg, | 20 | stopFfmpeg, |
22 | updateLive, | ||
23 | uploadVideoAndGetId, | 21 | uploadVideoAndGetId, |
24 | userLogin, | 22 | userLogin |
25 | waitUntilLivePublished | ||
26 | } from '../../../../shared/extra-utils' | 23 | } from '../../../../shared/extra-utils' |
27 | 24 | ||
28 | describe('Test video lives API validator', function () { | 25 | describe('Test video lives API validator', function () { |
@@ -32,6 +29,7 @@ describe('Test video lives API validator', function () { | |||
32 | let channelId: number | 29 | let channelId: number |
33 | let video: VideoCreateResult | 30 | let video: VideoCreateResult |
34 | let videoIdNotLive: number | 31 | let videoIdNotLive: number |
32 | let command: LiveCommand | ||
35 | 33 | ||
36 | // --------------------------------------------------------------- | 34 | // --------------------------------------------------------------- |
37 | 35 | ||
@@ -66,6 +64,8 @@ describe('Test video lives API validator', function () { | |||
66 | { | 64 | { |
67 | videoIdNotLive = (await uploadVideoAndGetId({ server, videoName: 'not live' })).id | 65 | videoIdNotLive = (await uploadVideoAndGetId({ server, videoName: 'not live' })).id |
68 | } | 66 | } |
67 | |||
68 | command = server.liveCommand | ||
69 | }) | 69 | }) |
70 | 70 | ||
71 | describe('When creating a live', function () { | 71 | describe('When creating a live', function () { |
@@ -337,70 +337,72 @@ describe('Test video lives API validator', function () { | |||
337 | describe('When getting live information', function () { | 337 | describe('When getting live information', function () { |
338 | 338 | ||
339 | it('Should fail without access token', async function () { | 339 | it('Should fail without access token', async function () { |
340 | await getLive(server.url, '', video.id, HttpStatusCode.UNAUTHORIZED_401) | 340 | await command.getLive({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
341 | }) | 341 | }) |
342 | 342 | ||
343 | it('Should fail with a bad access token', async function () { | 343 | it('Should fail with a bad access token', async function () { |
344 | await getLive(server.url, 'toto', video.id, HttpStatusCode.UNAUTHORIZED_401) | 344 | await command.getLive({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
345 | }) | 345 | }) |
346 | 346 | ||
347 | it('Should fail with access token of another user', async function () { | 347 | it('Should fail with access token of another user', async function () { |
348 | await getLive(server.url, userAccessToken, video.id, HttpStatusCode.FORBIDDEN_403) | 348 | await command.getLive({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
349 | }) | 349 | }) |
350 | 350 | ||
351 | it('Should fail with a bad video id', async function () { | 351 | it('Should fail with a bad video id', async function () { |
352 | await getLive(server.url, server.accessToken, 'toto', HttpStatusCode.BAD_REQUEST_400) | 352 | await command.getLive({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
353 | }) | 353 | }) |
354 | 354 | ||
355 | it('Should fail with an unknown video id', async function () { | 355 | it('Should fail with an unknown video id', async function () { |
356 | await getLive(server.url, server.accessToken, 454555, HttpStatusCode.NOT_FOUND_404) | 356 | await command.getLive({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
357 | }) | 357 | }) |
358 | 358 | ||
359 | it('Should fail with a non live video', async function () { | 359 | it('Should fail with a non live video', async function () { |
360 | await getLive(server.url, server.accessToken, videoIdNotLive, HttpStatusCode.NOT_FOUND_404) | 360 | await command.getLive({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
361 | }) | 361 | }) |
362 | 362 | ||
363 | it('Should succeed with the correct params', async function () { | 363 | it('Should succeed with the correct params', async function () { |
364 | await getLive(server.url, server.accessToken, video.id) | 364 | await command.getLive({ videoId: video.id }) |
365 | await getLive(server.url, server.accessToken, video.shortUUID) | 365 | await command.getLive({ videoId: video.uuid }) |
366 | await command.getLive({ videoId: video.shortUUID }) | ||
366 | }) | 367 | }) |
367 | }) | 368 | }) |
368 | 369 | ||
369 | describe('When updating live information', async function () { | 370 | describe('When updating live information', async function () { |
370 | 371 | ||
371 | it('Should fail without access token', async function () { | 372 | it('Should fail without access token', async function () { |
372 | await updateLive(server.url, '', video.id, {}, HttpStatusCode.UNAUTHORIZED_401) | 373 | await command.updateLive({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
373 | }) | 374 | }) |
374 | 375 | ||
375 | it('Should fail with a bad access token', async function () { | 376 | it('Should fail with a bad access token', async function () { |
376 | await updateLive(server.url, 'toto', video.id, {}, HttpStatusCode.UNAUTHORIZED_401) | 377 | await command.updateLive({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
377 | }) | 378 | }) |
378 | 379 | ||
379 | it('Should fail with access token of another user', async function () { | 380 | it('Should fail with access token of another user', async function () { |
380 | await updateLive(server.url, userAccessToken, video.id, {}, HttpStatusCode.FORBIDDEN_403) | 381 | await command.updateLive({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
381 | }) | 382 | }) |
382 | 383 | ||
383 | it('Should fail with a bad video id', async function () { | 384 | it('Should fail with a bad video id', async function () { |
384 | await updateLive(server.url, server.accessToken, 'toto', {}, HttpStatusCode.BAD_REQUEST_400) | 385 | await command.updateLive({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
385 | }) | 386 | }) |
386 | 387 | ||
387 | it('Should fail with an unknown video id', async function () { | 388 | it('Should fail with an unknown video id', async function () { |
388 | await updateLive(server.url, server.accessToken, 454555, {}, HttpStatusCode.NOT_FOUND_404) | 389 | await command.updateLive({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
389 | }) | 390 | }) |
390 | 391 | ||
391 | it('Should fail with a non live video', async function () { | 392 | it('Should fail with a non live video', async function () { |
392 | await updateLive(server.url, server.accessToken, videoIdNotLive, {}, HttpStatusCode.NOT_FOUND_404) | 393 | await command.updateLive({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
393 | }) | 394 | }) |
394 | 395 | ||
395 | it('Should fail with save replay and permanent live set to true', async function () { | 396 | it('Should fail with save replay and permanent live set to true', async function () { |
396 | const fields = { saveReplay: true, permanentLive: true } | 397 | const fields = { saveReplay: true, permanentLive: true } |
397 | 398 | ||
398 | await updateLive(server.url, server.accessToken, video.id, fields, HttpStatusCode.BAD_REQUEST_400) | 399 | await command.updateLive({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
399 | }) | 400 | }) |
400 | 401 | ||
401 | it('Should succeed with the correct params', async function () { | 402 | it('Should succeed with the correct params', async function () { |
402 | await updateLive(server.url, server.accessToken, video.id, { saveReplay: false }) | 403 | await command.updateLive({ videoId: video.id, fields: { saveReplay: false } }) |
403 | await updateLive(server.url, server.accessToken, video.shortUUID, { saveReplay: false }) | 404 | await command.updateLive({ videoId: video.uuid, fields: { saveReplay: false } }) |
405 | await command.updateLive({ videoId: video.shortUUID, fields: { saveReplay: false } }) | ||
404 | }) | 406 | }) |
405 | 407 | ||
406 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { | 408 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { |
@@ -413,36 +415,34 @@ describe('Test video lives API validator', function () { | |||
413 | } | 415 | } |
414 | }) | 416 | }) |
415 | 417 | ||
416 | await updateLive(server.url, server.accessToken, video.id, { saveReplay: true }, HttpStatusCode.FORBIDDEN_403) | 418 | await command.updateLive({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
417 | }) | 419 | }) |
418 | 420 | ||
419 | it('Should fail to update a live if it has already started', async function () { | 421 | it('Should fail to update a live if it has already started', async function () { |
420 | this.timeout(40000) | 422 | this.timeout(40000) |
421 | 423 | ||
422 | const resLive = await getLive(server.url, server.accessToken, video.id) | 424 | const live = await command.getLive({ videoId: video.id }) |
423 | const live: LiveVideo = resLive.body | ||
424 | 425 | ||
425 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) | 426 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
426 | 427 | ||
427 | await waitUntilLivePublished(server.url, server.accessToken, video.id) | 428 | await command.waitUntilLivePublished({ videoId: video.id }) |
428 | await updateLive(server.url, server.accessToken, video.id, {}, HttpStatusCode.BAD_REQUEST_400) | 429 | await command.updateLive({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
429 | 430 | ||
430 | await stopFfmpeg(command) | 431 | await stopFfmpeg(ffmpegCommand) |
431 | }) | 432 | }) |
432 | 433 | ||
433 | it('Should fail to stream twice in the save live', async function () { | 434 | it('Should fail to stream twice in the save live', async function () { |
434 | this.timeout(40000) | 435 | this.timeout(40000) |
435 | 436 | ||
436 | const resLive = await getLive(server.url, server.accessToken, video.id) | 437 | const live = await command.getLive({ videoId: video.id }) |
437 | const live: LiveVideo = resLive.body | ||
438 | 438 | ||
439 | const command = sendRTMPStream(live.rtmpUrl, live.streamKey) | 439 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
440 | 440 | ||
441 | await waitUntilLivePublished(server.url, server.accessToken, video.id) | 441 | await command.waitUntilLivePublished({ videoId: video.id }) |
442 | 442 | ||
443 | await runAndTestFfmpegStreamError(server.url, server.accessToken, video.id, true) | 443 | await command.runAndTestFfmpegStreamError({ videoId: video.id, shouldHaveError: true }) |
444 | 444 | ||
445 | await stopFfmpeg(command) | 445 | await stopFfmpeg(ffmpegCommand) |
446 | }) | 446 | }) |
447 | }) | 447 | }) |
448 | 448 | ||
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index c64d10dcd..5c4817b40 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts | |||
@@ -7,19 +7,16 @@ import { | |||
7 | checkLiveCleanup, | 7 | checkLiveCleanup, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | ConfigCommand, | 9 | ConfigCommand, |
10 | createLive, | ||
11 | doubleFollow, | 10 | doubleFollow, |
12 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
13 | generateUser, | 12 | generateUser, |
14 | getVideo, | 13 | getVideo, |
15 | runAndTestFfmpegStreamError, | ||
16 | ServerInfo, | 14 | ServerInfo, |
17 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
18 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
19 | updateUser, | 17 | updateUser, |
20 | wait, | 18 | wait, |
21 | waitJobs, | 19 | waitJobs |
22 | waitUntilLivePublished | ||
23 | } from '../../../../shared/extra-utils' | 20 | } from '../../../../shared/extra-utils' |
24 | 21 | ||
25 | const expect = chai.expect | 22 | const expect = chai.expect |
@@ -38,8 +35,8 @@ describe('Test live constraints', function () { | |||
38 | saveReplay | 35 | saveReplay |
39 | } | 36 | } |
40 | 37 | ||
41 | const res = await createLive(servers[0].url, userAccessToken, liveAttributes) | 38 | const { uuid } = await servers[0].liveCommand.createLive({ token: userAccessToken, fields: liveAttributes }) |
42 | return res.body.video.uuid as string | 39 | return uuid |
43 | } | 40 | } |
44 | 41 | ||
45 | async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) { | 42 | async function checkSaveReplay (videoId: string, resolutions = [ 720 ]) { |
@@ -56,7 +53,7 @@ describe('Test live constraints', function () { | |||
56 | 53 | ||
57 | async function waitUntilLivePublishedOnAllServers (videoId: string) { | 54 | async function waitUntilLivePublishedOnAllServers (videoId: string) { |
58 | for (const server of servers) { | 55 | for (const server of servers) { |
59 | await waitUntilLivePublished(server.url, server.accessToken, videoId) | 56 | await server.liveCommand.waitUntilLivePublished({ videoId }) |
60 | } | 57 | } |
61 | } | 58 | } |
62 | 59 | ||
@@ -108,7 +105,7 @@ describe('Test live constraints', function () { | |||
108 | this.timeout(60000) | 105 | this.timeout(60000) |
109 | 106 | ||
110 | const userVideoLiveoId = await createLiveWrapper(false) | 107 | const userVideoLiveoId = await createLiveWrapper(false) |
111 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) | 108 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) |
112 | }) | 109 | }) |
113 | 110 | ||
114 | 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', async function () { |
@@ -118,7 +115,7 @@ describe('Test live constraints', function () { | |||
118 | await wait(5000) | 115 | await wait(5000) |
119 | 116 | ||
120 | const userVideoLiveoId = await createLiveWrapper(true) | 117 | const userVideoLiveoId = await createLiveWrapper(true) |
121 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) | 118 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
122 | 119 | ||
123 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 120 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
124 | await waitJobs(servers) | 121 | await waitJobs(servers) |
@@ -135,7 +132,7 @@ describe('Test live constraints', function () { | |||
135 | await updateQuota({ total: -1, daily: 1 }) | 132 | await updateQuota({ total: -1, daily: 1 }) |
136 | 133 | ||
137 | const userVideoLiveoId = await createLiveWrapper(true) | 134 | const userVideoLiveoId = await createLiveWrapper(true) |
138 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) | 135 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
139 | 136 | ||
140 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 137 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
141 | await waitJobs(servers) | 138 | await waitJobs(servers) |
@@ -152,7 +149,7 @@ describe('Test live constraints', function () { | |||
152 | await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) | 149 | await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) |
153 | 150 | ||
154 | const userVideoLiveoId = await createLiveWrapper(true) | 151 | const userVideoLiveoId = await createLiveWrapper(true) |
155 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, false) | 152 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) |
156 | }) | 153 | }) |
157 | 154 | ||
158 | it('Should have max duration limit', async function () { | 155 | it('Should have max duration limit', async function () { |
@@ -173,7 +170,7 @@ describe('Test live constraints', function () { | |||
173 | }) | 170 | }) |
174 | 171 | ||
175 | const userVideoLiveoId = await createLiveWrapper(true) | 172 | const userVideoLiveoId = await createLiveWrapper(true) |
176 | await runAndTestFfmpegStreamError(servers[0].url, userAccessToken, userVideoLiveoId, true) | 173 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
177 | 174 | ||
178 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 175 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
179 | await waitJobs(servers) | 176 | await waitJobs(servers) |
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index b9e37c834..a0f70dfdb 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -6,22 +6,15 @@ import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | ConfigCommand, | 8 | ConfigCommand, |
9 | createLive, | ||
10 | doubleFollow, | 9 | doubleFollow, |
11 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
12 | getLive, | ||
13 | getPlaylistsCount, | ||
14 | getVideo, | 11 | getVideo, |
15 | sendRTMPStreamInVideo, | ||
16 | ServerInfo, | 12 | ServerInfo, |
17 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
18 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
19 | stopFfmpeg, | 15 | stopFfmpeg, |
20 | updateLive, | ||
21 | wait, | 16 | wait, |
22 | waitJobs, | 17 | waitJobs |
23 | waitUntilLivePublished, | ||
24 | waitUntilLiveWaiting | ||
25 | } from '../../../../shared/extra-utils' | 18 | } from '../../../../shared/extra-utils' |
26 | 19 | ||
27 | const expect = chai.expect | 20 | const expect = chai.expect |
@@ -39,8 +32,8 @@ describe('Permanent live', function () { | |||
39 | permanentLive | 32 | permanentLive |
40 | } | 33 | } |
41 | 34 | ||
42 | const res = await createLive(servers[0].url, servers[0].accessToken, attributes) | 35 | const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes }) |
43 | return res.body.video.uuid | 36 | return uuid |
44 | } | 37 | } |
45 | 38 | ||
46 | async function checkVideoState (videoId: string, state: VideoState) { | 39 | async function checkVideoState (videoId: string, state: VideoState) { |
@@ -83,15 +76,15 @@ describe('Permanent live', function () { | |||
83 | const videoUUID = await createLiveWrapper(false) | 76 | const videoUUID = await createLiveWrapper(false) |
84 | 77 | ||
85 | { | 78 | { |
86 | const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) | 79 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) |
87 | expect(res.body.permanentLive).to.be.false | 80 | expect(live.permanentLive).to.be.false |
88 | } | 81 | } |
89 | 82 | ||
90 | await updateLive(servers[0].url, servers[0].accessToken, videoUUID, { permanentLive: true }) | 83 | await servers[0].liveCommand.updateLive({ videoId: videoUUID, fields: { permanentLive: true } }) |
91 | 84 | ||
92 | { | 85 | { |
93 | const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) | 86 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) |
94 | expect(res.body.permanentLive).to.be.true | 87 | expect(live.permanentLive).to.be.true |
95 | } | 88 | } |
96 | }) | 89 | }) |
97 | 90 | ||
@@ -100,8 +93,8 @@ describe('Permanent live', function () { | |||
100 | 93 | ||
101 | videoUUID = await createLiveWrapper(true) | 94 | videoUUID = await createLiveWrapper(true) |
102 | 95 | ||
103 | const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) | 96 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) |
104 | expect(res.body.permanentLive).to.be.true | 97 | expect(live.permanentLive).to.be.true |
105 | 98 | ||
106 | await waitJobs(servers) | 99 | await waitJobs(servers) |
107 | }) | 100 | }) |
@@ -109,16 +102,16 @@ describe('Permanent live', function () { | |||
109 | it('Should stream into this permanent live', async function () { | 102 | it('Should stream into this permanent live', async function () { |
110 | this.timeout(120000) | 103 | this.timeout(120000) |
111 | 104 | ||
112 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) | 105 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) |
113 | 106 | ||
114 | for (const server of servers) { | 107 | for (const server of servers) { |
115 | await waitUntilLivePublished(server.url, server.accessToken, videoUUID) | 108 | await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID }) |
116 | } | 109 | } |
117 | 110 | ||
118 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 111 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
119 | 112 | ||
120 | await stopFfmpeg(command) | 113 | await stopFfmpeg(ffmpegCommand) |
121 | await waitUntilLiveWaiting(servers[0].url, servers[0].accessToken, videoUUID) | 114 | await servers[0].liveCommand.waitUntilLiveWaiting({ videoId: videoUUID }) |
122 | 115 | ||
123 | await waitJobs(servers) | 116 | await waitJobs(servers) |
124 | }) | 117 | }) |
@@ -160,19 +153,19 @@ describe('Permanent live', function () { | |||
160 | } | 153 | } |
161 | }) | 154 | }) |
162 | 155 | ||
163 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) | 156 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) |
164 | 157 | ||
165 | for (const server of servers) { | 158 | for (const server of servers) { |
166 | await waitUntilLivePublished(server.url, server.accessToken, videoUUID) | 159 | await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID }) |
167 | } | 160 | } |
168 | 161 | ||
169 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 162 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
170 | 163 | ||
171 | const count = await getPlaylistsCount(servers[0], videoUUID) | 164 | const count = await servers[0].liveCommand.getPlaylistsCount({ videoUUID }) |
172 | // master playlist and 720p playlist | 165 | // master playlist and 720p playlist |
173 | expect(count).to.equal(2) | 166 | expect(count).to.equal(2) |
174 | 167 | ||
175 | await stopFfmpeg(command) | 168 | await stopFfmpeg(ffmpegCommand) |
176 | }) | 169 | }) |
177 | 170 | ||
178 | after(async function () { | 171 | after(async function () { |
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index e74bc3e8d..d3c252ffd 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts | |||
@@ -10,13 +10,11 @@ import { | |||
10 | checkLiveCleanup, | 10 | checkLiveCleanup, |
11 | cleanupTests, | 11 | cleanupTests, |
12 | ConfigCommand, | 12 | ConfigCommand, |
13 | createLive, | ||
14 | doubleFollow, | 13 | doubleFollow, |
15 | flushAndRunMultipleServers, | 14 | flushAndRunMultipleServers, |
16 | getVideo, | 15 | getVideo, |
17 | getVideosList, | 16 | getVideosList, |
18 | removeVideo, | 17 | removeVideo, |
19 | sendRTMPStreamInVideo, | ||
20 | ServerInfo, | 18 | ServerInfo, |
21 | setAccessTokensToServers, | 19 | setAccessTokensToServers, |
22 | setDefaultVideoChannel, | 20 | setDefaultVideoChannel, |
@@ -24,10 +22,7 @@ import { | |||
24 | testFfmpegStreamError, | 22 | testFfmpegStreamError, |
25 | updateVideo, | 23 | updateVideo, |
26 | wait, | 24 | wait, |
27 | waitJobs, | 25 | waitJobs |
28 | waitUntilLiveEnded, | ||
29 | waitUntilLivePublished, | ||
30 | waitUntilLiveSaved | ||
31 | } from '../../../../shared/extra-utils' | 26 | } from '../../../../shared/extra-utils' |
32 | 27 | ||
33 | const expect = chai.expect | 28 | const expect = chai.expect |
@@ -52,8 +47,8 @@ describe('Save replay setting', function () { | |||
52 | saveReplay | 47 | saveReplay |
53 | } | 48 | } |
54 | 49 | ||
55 | const res = await createLive(servers[0].url, servers[0].accessToken, attributes) | 50 | const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes }) |
56 | return res.body.video.uuid | 51 | return uuid |
57 | } | 52 | } |
58 | 53 | ||
59 | async function checkVideosExist (videoId: string, existsInList: boolean, getStatus?: number) { | 54 | async function checkVideosExist (videoId: string, existsInList: boolean, getStatus?: number) { |
@@ -79,13 +74,13 @@ describe('Save replay setting', function () { | |||
79 | 74 | ||
80 | async function waitUntilLivePublishedOnAllServers (videoId: string) { | 75 | async function waitUntilLivePublishedOnAllServers (videoId: string) { |
81 | for (const server of servers) { | 76 | for (const server of servers) { |
82 | await waitUntilLivePublished(server.url, server.accessToken, videoId) | 77 | await server.liveCommand.waitUntilLivePublished({ videoId }) |
83 | } | 78 | } |
84 | } | 79 | } |
85 | 80 | ||
86 | async function waitUntilLiveSavedOnAllServers (videoId: string) { | 81 | async function waitUntilLiveSavedOnAllServers (videoId: string) { |
87 | for (const server of servers) { | 82 | for (const server of servers) { |
88 | await waitUntilLiveSaved(server.url, server.accessToken, videoId) | 83 | await server.liveCommand.waitUntilLiveSaved({ videoId }) |
89 | } | 84 | } |
90 | } | 85 | } |
91 | 86 | ||
@@ -136,7 +131,7 @@ describe('Save replay setting', function () { | |||
136 | it('Should correctly have updated the live and federated it when streaming in the live', async function () { | 131 | it('Should correctly have updated the live and federated it when streaming in the live', async function () { |
137 | this.timeout(30000) | 132 | this.timeout(30000) |
138 | 133 | ||
139 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 134 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
140 | 135 | ||
141 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 136 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
142 | 137 | ||
@@ -152,7 +147,7 @@ describe('Save replay setting', function () { | |||
152 | await stopFfmpeg(ffmpegCommand) | 147 | await stopFfmpeg(ffmpegCommand) |
153 | 148 | ||
154 | for (const server of servers) { | 149 | for (const server of servers) { |
155 | await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) | 150 | await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID }) |
156 | } | 151 | } |
157 | await waitJobs(servers) | 152 | await waitJobs(servers) |
158 | 153 | ||
@@ -169,7 +164,7 @@ describe('Save replay setting', function () { | |||
169 | 164 | ||
170 | liveVideoUUID = await createLiveWrapper(false) | 165 | liveVideoUUID = await createLiveWrapper(false) |
171 | 166 | ||
172 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 167 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
173 | 168 | ||
174 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 169 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
175 | 170 | ||
@@ -198,7 +193,7 @@ describe('Save replay setting', function () { | |||
198 | 193 | ||
199 | liveVideoUUID = await createLiveWrapper(false) | 194 | liveVideoUUID = await createLiveWrapper(false) |
200 | 195 | ||
201 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 196 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
202 | 197 | ||
203 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 198 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
204 | 199 | ||
@@ -234,7 +229,7 @@ describe('Save replay setting', function () { | |||
234 | it('Should correctly have updated the live and federated it when streaming in the live', async function () { | 229 | it('Should correctly have updated the live and federated it when streaming in the live', async function () { |
235 | this.timeout(20000) | 230 | this.timeout(20000) |
236 | 231 | ||
237 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 232 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
238 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 233 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
239 | 234 | ||
240 | await waitJobs(servers) | 235 | await waitJobs(servers) |
@@ -278,7 +273,7 @@ describe('Save replay setting', function () { | |||
278 | 273 | ||
279 | liveVideoUUID = await createLiveWrapper(true) | 274 | liveVideoUUID = await createLiveWrapper(true) |
280 | 275 | ||
281 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 276 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
282 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 277 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
283 | 278 | ||
284 | await waitJobs(servers) | 279 | await waitJobs(servers) |
@@ -306,7 +301,7 @@ describe('Save replay setting', function () { | |||
306 | 301 | ||
307 | liveVideoUUID = await createLiveWrapper(true) | 302 | liveVideoUUID = await createLiveWrapper(true) |
308 | 303 | ||
309 | ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 304 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
310 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | 305 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
311 | 306 | ||
312 | await waitJobs(servers) | 307 | await waitJobs(servers) |
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 20fec16a9..73a300384 100644 --- a/server/tests/api/live/live-socket-messages.ts +++ b/server/tests/api/live/live-socket-messages.ts | |||
@@ -5,11 +5,9 @@ import * as chai from 'chai' | |||
5 | import { VideoPrivacy, VideoState } from '@shared/models' | 5 | import { VideoPrivacy, VideoState } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | createLive, | ||
9 | doubleFollow, | 8 | doubleFollow, |
10 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
11 | getVideoIdFromUUID, | 10 | getVideoIdFromUUID, |
12 | sendRTMPStreamInVideo, | ||
13 | ServerInfo, | 11 | ServerInfo, |
14 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
15 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
@@ -17,7 +15,6 @@ import { | |||
17 | viewVideo, | 15 | viewVideo, |
18 | wait, | 16 | wait, |
19 | waitJobs, | 17 | waitJobs, |
20 | waitUntilLiveEnded, | ||
21 | waitUntilLivePublishedOnAllServers | 18 | waitUntilLivePublishedOnAllServers |
22 | } from '../../../../shared/extra-utils' | 19 | } from '../../../../shared/extra-utils' |
23 | 20 | ||
@@ -60,8 +57,8 @@ describe('Test live', function () { | |||
60 | privacy: VideoPrivacy.PUBLIC | 57 | privacy: VideoPrivacy.PUBLIC |
61 | } | 58 | } |
62 | 59 | ||
63 | const res = await createLive(servers[0].url, servers[0].accessToken, liveAttributes) | 60 | const { uuid } = await servers[0].liveCommand.createLive({ fields: liveAttributes }) |
64 | return res.body.video.uuid | 61 | return uuid |
65 | } | 62 | } |
66 | 63 | ||
67 | it('Should correctly send a message when the live starts and ends', async function () { | 64 | it('Should correctly send a message when the live starts and ends', async function () { |
@@ -89,7 +86,7 @@ describe('Test live', function () { | |||
89 | remoteSocket.emit('subscribe', { videoId }) | 86 | remoteSocket.emit('subscribe', { videoId }) |
90 | } | 87 | } |
91 | 88 | ||
92 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 89 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
93 | 90 | ||
94 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) | 91 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) |
95 | await waitJobs(servers) | 92 | await waitJobs(servers) |
@@ -99,10 +96,10 @@ describe('Test live', function () { | |||
99 | expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.PUBLISHED) | 96 | expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.PUBLISHED) |
100 | } | 97 | } |
101 | 98 | ||
102 | await stopFfmpeg(command) | 99 | await stopFfmpeg(ffmpegCommand) |
103 | 100 | ||
104 | for (const server of servers) { | 101 | for (const server of servers) { |
105 | await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) | 102 | await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID }) |
106 | } | 103 | } |
107 | await waitJobs(servers) | 104 | await waitJobs(servers) |
108 | 105 | ||
@@ -137,7 +134,7 @@ describe('Test live', function () { | |||
137 | remoteSocket.emit('subscribe', { videoId }) | 134 | remoteSocket.emit('subscribe', { videoId }) |
138 | } | 135 | } |
139 | 136 | ||
140 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 137 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
141 | 138 | ||
142 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) | 139 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) |
143 | await waitJobs(servers) | 140 | await waitJobs(servers) |
@@ -155,7 +152,7 @@ describe('Test live', function () { | |||
155 | expect(localLastVideoViews).to.equal(2) | 152 | expect(localLastVideoViews).to.equal(2) |
156 | expect(remoteLastVideoViews).to.equal(2) | 153 | expect(remoteLastVideoViews).to.equal(2) |
157 | 154 | ||
158 | await stopFfmpeg(command) | 155 | await stopFfmpeg(ffmpegCommand) |
159 | }) | 156 | }) |
160 | 157 | ||
161 | it('Should not receive a notification after unsubscribe', async function () { | 158 | it('Should not receive a notification after unsubscribe', async function () { |
@@ -172,7 +169,7 @@ describe('Test live', function () { | |||
172 | socket.on('state-change', data => stateChanges.push(data.state)) | 169 | socket.on('state-change', data => stateChanges.push(data.state)) |
173 | socket.emit('subscribe', { videoId }) | 170 | socket.emit('subscribe', { videoId }) |
174 | 171 | ||
175 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 172 | const command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoUUID }) |
176 | 173 | ||
177 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) | 174 | await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID) |
178 | await waitJobs(servers) | 175 | await waitJobs(servers) |
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts index ca571c962..ae6af7cfd 100644 --- a/server/tests/api/live/live-views.ts +++ b/server/tests/api/live/live-views.ts | |||
@@ -6,11 +6,9 @@ import { FfmpegCommand } from 'fluent-ffmpeg' | |||
6 | import { VideoDetails, VideoPrivacy } from '@shared/models' | 6 | import { VideoDetails, VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | createLive, | ||
10 | doubleFollow, | 9 | doubleFollow, |
11 | flushAndRunMultipleServers, | 10 | flushAndRunMultipleServers, |
12 | getVideo, | 11 | getVideo, |
13 | sendRTMPStreamInVideo, | ||
14 | ServerInfo, | 12 | ServerInfo, |
15 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
16 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
@@ -73,10 +71,10 @@ describe('Test live', function () { | |||
73 | privacy: VideoPrivacy.PUBLIC | 71 | privacy: VideoPrivacy.PUBLIC |
74 | } | 72 | } |
75 | 73 | ||
76 | const res = await createLive(servers[0].url, servers[0].accessToken, liveAttributes) | 74 | const live = await servers[0].liveCommand.createLive({ fields: liveAttributes }) |
77 | liveVideoId = res.body.video.uuid | 75 | liveVideoId = live.uuid |
78 | 76 | ||
79 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 77 | command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) |
80 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 78 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
81 | await waitJobs(servers) | 79 | await waitJobs(servers) |
82 | }) | 80 | }) |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 2c3102994..5b4e479b6 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -13,41 +13,36 @@ import { | |||
13 | checkLiveSegmentHash, | 13 | checkLiveSegmentHash, |
14 | checkResolutionsInMasterPlaylist, | 14 | checkResolutionsInMasterPlaylist, |
15 | cleanupTests, | 15 | cleanupTests, |
16 | createLive, | ||
17 | doubleFollow, | 16 | doubleFollow, |
18 | flushAndRunMultipleServers, | 17 | flushAndRunMultipleServers, |
19 | getLive, | ||
20 | getMyVideosWithFilter, | 18 | getMyVideosWithFilter, |
21 | getPlaylist, | 19 | getPlaylist, |
22 | getVideo, | 20 | getVideo, |
23 | getVideosList, | 21 | getVideosList, |
24 | getVideosWithFilters, | 22 | getVideosWithFilters, |
25 | killallServers, | 23 | killallServers, |
24 | LiveCommand, | ||
26 | makeRawRequest, | 25 | makeRawRequest, |
27 | removeVideo, | 26 | removeVideo, |
28 | reRunServer, | 27 | reRunServer, |
29 | sendRTMPStream, | 28 | sendRTMPStream, |
30 | sendRTMPStreamInVideo, | ||
31 | ServerInfo, | 29 | ServerInfo, |
32 | setAccessTokensToServers, | 30 | setAccessTokensToServers, |
33 | setDefaultVideoChannel, | 31 | setDefaultVideoChannel, |
34 | stopFfmpeg, | 32 | stopFfmpeg, |
35 | testFfmpegStreamError, | 33 | testFfmpegStreamError, |
36 | testImage, | 34 | testImage, |
37 | updateLive, | ||
38 | uploadVideoAndGetId, | 35 | uploadVideoAndGetId, |
39 | wait, | 36 | wait, |
40 | waitJobs, | 37 | waitJobs, |
41 | waitUntilLiveEnded, | 38 | waitUntilLivePublishedOnAllServers |
42 | waitUntilLivePublished, | ||
43 | waitUntilLivePublishedOnAllServers, | ||
44 | waitUntilLiveSegmentGeneration | ||
45 | } from '../../../../shared/extra-utils' | 39 | } from '../../../../shared/extra-utils' |
46 | 40 | ||
47 | const expect = chai.expect | 41 | const expect = chai.expect |
48 | 42 | ||
49 | describe('Test live', function () { | 43 | describe('Test live', function () { |
50 | let servers: ServerInfo[] = [] | 44 | let servers: ServerInfo[] = [] |
45 | let commands: LiveCommand[] | ||
51 | 46 | ||
52 | before(async function () { | 47 | before(async function () { |
53 | this.timeout(120000) | 48 | this.timeout(120000) |
@@ -72,6 +67,8 @@ describe('Test live', function () { | |||
72 | 67 | ||
73 | // Server 1 and server 2 follow each other | 68 | // Server 1 and server 2 follow each other |
74 | await doubleFollow(servers[0], servers[1]) | 69 | await doubleFollow(servers[0], servers[1]) |
70 | |||
71 | commands = servers.map(s => s.liveCommand) | ||
75 | }) | 72 | }) |
76 | 73 | ||
77 | describe('Live creation, update and delete', function () { | 74 | describe('Live creation, update and delete', function () { |
@@ -99,8 +96,8 @@ describe('Test live', function () { | |||
99 | thumbnailfile: 'video_short1.webm.jpg' | 96 | thumbnailfile: 'video_short1.webm.jpg' |
100 | } | 97 | } |
101 | 98 | ||
102 | const res = await createLive(servers[0].url, servers[0].accessToken, attributes) | 99 | const live = await commands[0].createLive({ fields: attributes }) |
103 | liveVideoUUID = res.body.video.uuid | 100 | liveVideoUUID = live.uuid |
104 | 101 | ||
105 | await waitJobs(servers) | 102 | await waitJobs(servers) |
106 | 103 | ||
@@ -130,8 +127,7 @@ describe('Test live', function () { | |||
130 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) | 127 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) |
131 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) | 128 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) |
132 | 129 | ||
133 | const resLive = await getLive(server.url, server.accessToken, liveVideoUUID) | 130 | const live = await server.liveCommand.getLive({ videoId: liveVideoUUID }) |
134 | const live: LiveVideo = resLive.body | ||
135 | 131 | ||
136 | if (server.url === servers[0].url) { | 132 | if (server.url === servers[0].url) { |
137 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 133 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -155,8 +151,8 @@ describe('Test live', function () { | |||
155 | nsfw: true | 151 | nsfw: true |
156 | } | 152 | } |
157 | 153 | ||
158 | const res = await createLive(servers[0].url, servers[0].accessToken, attributes) | 154 | const live = await commands[0].createLive({ fields: attributes }) |
159 | const videoId = res.body.video.uuid | 155 | const videoId = live.uuid |
160 | 156 | ||
161 | await waitJobs(servers) | 157 | await waitJobs(servers) |
162 | 158 | ||
@@ -182,20 +178,19 @@ describe('Test live', function () { | |||
182 | }) | 178 | }) |
183 | 179 | ||
184 | it('Should not be able to update a live of another server', async function () { | 180 | it('Should not be able to update a live of another server', async function () { |
185 | await updateLive(servers[1].url, servers[1].accessToken, liveVideoUUID, { saveReplay: false }, HttpStatusCode.FORBIDDEN_403) | 181 | await commands[1].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
186 | }) | 182 | }) |
187 | 183 | ||
188 | it('Should update the live', async function () { | 184 | it('Should update the live', async function () { |
189 | this.timeout(10000) | 185 | this.timeout(10000) |
190 | 186 | ||
191 | await updateLive(servers[0].url, servers[0].accessToken, liveVideoUUID, { saveReplay: false }) | 187 | await commands[0].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false } }) |
192 | await waitJobs(servers) | 188 | await waitJobs(servers) |
193 | }) | 189 | }) |
194 | 190 | ||
195 | it('Have the live updated', async function () { | 191 | it('Have the live updated', async function () { |
196 | for (const server of servers) { | 192 | for (const server of servers) { |
197 | const res = await getLive(server.url, server.accessToken, liveVideoUUID) | 193 | const live = await server.liveCommand.getLive({ videoId: liveVideoUUID }) |
198 | const live: LiveVideo = res.body | ||
199 | 194 | ||
200 | if (server.url === servers[0].url) { | 195 | if (server.url === servers[0].url) { |
201 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 196 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -219,13 +214,13 @@ describe('Test live', function () { | |||
219 | it('Should have the live deleted', async function () { | 214 | it('Should have the live deleted', async function () { |
220 | for (const server of servers) { | 215 | for (const server of servers) { |
221 | await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) | 216 | await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) |
222 | await getLive(server.url, server.accessToken, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) | 217 | await server.liveCommand.getLive({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
223 | } | 218 | } |
224 | }) | 219 | }) |
225 | }) | 220 | }) |
226 | 221 | ||
227 | describe('Live filters', function () { | 222 | describe('Live filters', function () { |
228 | let command: any | 223 | let ffmpegCommand: any |
229 | let liveVideoId: string | 224 | let liveVideoId: string |
230 | let vodVideoId: string | 225 | let vodVideoId: string |
231 | 226 | ||
@@ -235,10 +230,10 @@ describe('Test live', function () { | |||
235 | vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid | 230 | vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid |
236 | 231 | ||
237 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } | 232 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } |
238 | const resLive = await createLive(servers[0].url, servers[0].accessToken, liveOptions) | 233 | const live = await commands[0].createLive({ fields: liveOptions }) |
239 | liveVideoId = resLive.body.video.uuid | 234 | liveVideoId = live.uuid |
240 | 235 | ||
241 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 236 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) |
242 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 237 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
243 | await waitJobs(servers) | 238 | await waitJobs(servers) |
244 | }) | 239 | }) |
@@ -262,7 +257,7 @@ describe('Test live', function () { | |||
262 | it('Should display my lives', async function () { | 257 | it('Should display my lives', async function () { |
263 | this.timeout(60000) | 258 | this.timeout(60000) |
264 | 259 | ||
265 | await stopFfmpeg(command) | 260 | await stopFfmpeg(ffmpegCommand) |
266 | await waitJobs(servers) | 261 | await waitJobs(servers) |
267 | 262 | ||
268 | const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: true }) | 263 | const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: true }) |
@@ -302,13 +297,12 @@ describe('Test live', function () { | |||
302 | saveReplay: false | 297 | saveReplay: false |
303 | } | 298 | } |
304 | 299 | ||
305 | const res = await createLive(servers[0].url, servers[0].accessToken, liveAttributes) | 300 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) |
306 | const uuid = res.body.video.uuid | ||
307 | 301 | ||
308 | const resLive = await getLive(servers[0].url, servers[0].accessToken, uuid) | 302 | const live = await commands[0].getLive({ videoId: uuid }) |
309 | const resVideo = await getVideo(servers[0].url, uuid) | 303 | const resVideo = await getVideo(servers[0].url, uuid) |
310 | 304 | ||
311 | return Object.assign(resVideo.body, resLive.body) as LiveVideo & VideoDetails | 305 | return Object.assign(resVideo.body as VideoDetails, live) |
312 | } | 306 | } |
313 | 307 | ||
314 | it('Should not allow a stream without the appropriate path', async function () { | 308 | it('Should not allow a stream without the appropriate path', async function () { |
@@ -382,8 +376,8 @@ describe('Test live', function () { | |||
382 | saveReplay | 376 | saveReplay |
383 | } | 377 | } |
384 | 378 | ||
385 | const res = await createLive(servers[0].url, servers[0].accessToken, liveAttributes) | 379 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) |
386 | return res.body.video.uuid | 380 | return uuid |
387 | } | 381 | } |
388 | 382 | ||
389 | async function testVideoResolutions (liveVideoId: string, resolutions: number[]) { | 383 | async function testVideoResolutions (liveVideoId: string, resolutions: number[]) { |
@@ -409,7 +403,7 @@ describe('Test live', function () { | |||
409 | for (let i = 0; i < resolutions.length; i++) { | 403 | for (let i = 0; i < resolutions.length; i++) { |
410 | const segmentNum = 3 | 404 | const segmentNum = 3 |
411 | const segmentName = `${i}-00000${segmentNum}.ts` | 405 | const segmentName = `${i}-00000${segmentNum}.ts` |
412 | await waitUntilLiveSegmentGeneration(servers[0], video.uuid, i, segmentNum) | 406 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) |
413 | 407 | ||
414 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) | 408 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) |
415 | const subPlaylist = res.text | 409 | const subPlaylist = res.text |
@@ -454,13 +448,13 @@ describe('Test live', function () { | |||
454 | 448 | ||
455 | liveVideoId = await createLiveWrapper(false) | 449 | liveVideoId = await createLiveWrapper(false) |
456 | 450 | ||
457 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 451 | const ffmpegCommand = await commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId }) |
458 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 452 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
459 | await waitJobs(servers) | 453 | await waitJobs(servers) |
460 | 454 | ||
461 | await testVideoResolutions(liveVideoId, [ 720 ]) | 455 | await testVideoResolutions(liveVideoId, [ 720 ]) |
462 | 456 | ||
463 | await stopFfmpeg(command) | 457 | await stopFfmpeg(ffmpegCommand) |
464 | }) | 458 | }) |
465 | 459 | ||
466 | it('Should enable transcoding with some resolutions', async function () { | 460 | it('Should enable transcoding with some resolutions', async function () { |
@@ -470,13 +464,13 @@ describe('Test live', function () { | |||
470 | await updateConf(resolutions) | 464 | await updateConf(resolutions) |
471 | liveVideoId = await createLiveWrapper(false) | 465 | liveVideoId = await createLiveWrapper(false) |
472 | 466 | ||
473 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 467 | const ffmpegCommand = await commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId }) |
474 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 468 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
475 | await waitJobs(servers) | 469 | await waitJobs(servers) |
476 | 470 | ||
477 | await testVideoResolutions(liveVideoId, resolutions) | 471 | await testVideoResolutions(liveVideoId, resolutions) |
478 | 472 | ||
479 | await stopFfmpeg(command) | 473 | await stopFfmpeg(ffmpegCommand) |
480 | }) | 474 | }) |
481 | 475 | ||
482 | it('Should enable transcoding with some resolutions and correctly save them', async function () { | 476 | it('Should enable transcoding with some resolutions and correctly save them', async function () { |
@@ -487,14 +481,14 @@ describe('Test live', function () { | |||
487 | await updateConf(resolutions) | 481 | await updateConf(resolutions) |
488 | liveVideoId = await createLiveWrapper(true) | 482 | liveVideoId = await createLiveWrapper(true) |
489 | 483 | ||
490 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') | 484 | const ffmpegCommand = await commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
491 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 485 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
492 | await waitJobs(servers) | 486 | await waitJobs(servers) |
493 | 487 | ||
494 | await testVideoResolutions(liveVideoId, resolutions) | 488 | await testVideoResolutions(liveVideoId, resolutions) |
495 | 489 | ||
496 | await stopFfmpeg(command) | 490 | await stopFfmpeg(ffmpegCommand) |
497 | await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId) | 491 | await commands[0].waitUntilLiveEnded({ videoId: liveVideoId }) |
498 | 492 | ||
499 | await waitJobs(servers) | 493 | await waitJobs(servers) |
500 | 494 | ||
@@ -565,8 +559,8 @@ describe('Test live', function () { | |||
565 | saveReplay | 559 | saveReplay |
566 | } | 560 | } |
567 | 561 | ||
568 | const res = await createLive(servers[0].url, servers[0].accessToken, liveAttributes) | 562 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) |
569 | return res.body.video.uuid | 563 | return uuid |
570 | } | 564 | } |
571 | 565 | ||
572 | before(async function () { | 566 | before(async function () { |
@@ -576,17 +570,17 @@ describe('Test live', function () { | |||
576 | liveVideoReplayId = await createLiveWrapper(true) | 570 | liveVideoReplayId = await createLiveWrapper(true) |
577 | 571 | ||
578 | await Promise.all([ | 572 | await Promise.all([ |
579 | sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId), | 573 | commands[0].sendRTMPStreamInVideo({ videoId: liveVideoId }), |
580 | sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoReplayId) | 574 | commands[0].sendRTMPStreamInVideo({ videoId: liveVideoReplayId }) |
581 | ]) | 575 | ]) |
582 | 576 | ||
583 | await Promise.all([ | 577 | await Promise.all([ |
584 | waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId), | 578 | commands[0].waitUntilLivePublished({ videoId: liveVideoId }), |
585 | waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoReplayId) | 579 | commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId }) |
586 | ]) | 580 | ]) |
587 | 581 | ||
588 | await waitUntilLiveSegmentGeneration(servers[0], liveVideoId, 0, 2) | 582 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) |
589 | await waitUntilLiveSegmentGeneration(servers[0], liveVideoReplayId, 0, 2) | 583 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) |
590 | 584 | ||
591 | await killallServers([ servers[0] ]) | 585 | await killallServers([ servers[0] ]) |
592 | await reRunServer(servers[0]) | 586 | await reRunServer(servers[0]) |
@@ -597,13 +591,13 @@ describe('Test live', function () { | |||
597 | it('Should cleanup lives', async function () { | 591 | it('Should cleanup lives', async function () { |
598 | this.timeout(60000) | 592 | this.timeout(60000) |
599 | 593 | ||
600 | await waitUntilLiveEnded(servers[0].url, servers[0].accessToken, liveVideoId) | 594 | await commands[0].waitUntilLiveEnded({ videoId: liveVideoId }) |
601 | }) | 595 | }) |
602 | 596 | ||
603 | it('Should save a live replay', async function () { | 597 | it('Should save a live replay', async function () { |
604 | this.timeout(120000) | 598 | this.timeout(120000) |
605 | 599 | ||
606 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoReplayId) | 600 | await commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId }) |
607 | }) | 601 | }) |
608 | }) | 602 | }) |
609 | 603 | ||
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 7dc89c447..af74b26a7 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -2,23 +2,20 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { VideoPrivacy } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createLive, | 7 | createVideoCaption, |
9 | flushAndRunServer, | 8 | flushAndRunServer, |
10 | immutableAssign, | 9 | immutableAssign, |
11 | SearchCommand, | 10 | SearchCommand, |
12 | sendRTMPStreamInVideo, | ||
13 | ServerInfo, | 11 | ServerInfo, |
14 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
15 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
16 | stopFfmpeg, | 14 | stopFfmpeg, |
17 | uploadVideo, | 15 | uploadVideo, |
18 | wait, | 16 | wait |
19 | waitUntilLivePublished | 17 | } from '@shared/extra-utils' |
20 | } from '../../../../shared/extra-utils' | 18 | import { VideoPrivacy } from '@shared/models' |
21 | import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' | ||
22 | 19 | ||
23 | const expect = chai.expect | 20 | const expect = chai.expect |
24 | 21 | ||
@@ -502,12 +499,13 @@ describe('Test videos search', function () { | |||
502 | } | 499 | } |
503 | 500 | ||
504 | { | 501 | { |
505 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id } | 502 | const liveCommand = server.liveCommand |
506 | const resLive = await createLive(server.url, server.accessToken, liveOptions) | 503 | |
507 | const liveVideoId = resLive.body.video.uuid | 504 | const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id } |
505 | const live = await liveCommand.createLive({ fields: liveAttributes }) | ||
508 | 506 | ||
509 | const ffmpegCommand = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId) | 507 | const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id }) |
510 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 508 | await liveCommand.waitUntilLivePublished({ videoId: live.id }) |
511 | 509 | ||
512 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) | 510 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) |
513 | 511 | ||
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index 89dba14b1..88e4d51a2 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -7,7 +7,6 @@ import { | |||
7 | acceptChangeOwnership, | 7 | acceptChangeOwnership, |
8 | changeVideoOwnership, | 8 | changeVideoOwnership, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | createUser, | 10 | createUser, |
12 | doubleFollow, | 11 | doubleFollow, |
13 | flushAndRunMultipleServers, | 12 | flushAndRunMultipleServers, |
@@ -112,9 +111,9 @@ describe('Test video change ownership - nominal', function () { | |||
112 | 111 | ||
113 | { | 112 | { |
114 | const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } | 113 | const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } |
115 | const res = await createLive(servers[0].url, firstUserAccessToken, attributes) | 114 | const video = await servers[0].liveCommand.createLive({ token: firstUserAccessToken, fields: attributes }) |
116 | 115 | ||
117 | liveId = res.body.video.id | 116 | liveId = video.id |
118 | } | 117 | } |
119 | 118 | ||
120 | await doubleFollow(servers[0], servers[1]) | 119 | await doubleFollow(servers[0], servers[1]) |
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 0de5b523b..39266c62f 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -7,7 +7,6 @@ import { | |||
7 | addVideoCommentThread, | 7 | addVideoCommentThread, |
8 | addVideoInPlaylist, | 8 | addVideoInPlaylist, |
9 | blockUser, | 9 | blockUser, |
10 | createLive, | ||
11 | createUser, | 10 | createUser, |
12 | createVideoPlaylist, | 11 | createVideoPlaylist, |
13 | deleteVideoComment, | 12 | deleteVideoComment, |
@@ -96,7 +95,7 @@ describe('Test plugin action hooks', function () { | |||
96 | channelId: servers[0].videoChannel.id | 95 | channelId: servers[0].videoChannel.id |
97 | } | 96 | } |
98 | 97 | ||
99 | await createLive(servers[0].url, servers[0].accessToken, attributes) | 98 | await servers[0].liveCommand.createLive({ fields: attributes }) |
100 | 99 | ||
101 | await checkHook('action:api.live-video.created') | 100 | await checkHook('action:api.live-video.created') |
102 | }) | 101 | }) |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e254046bf..e60bad38d 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -7,7 +7,6 @@ import { | |||
7 | addVideoCommentReply, | 7 | addVideoCommentReply, |
8 | addVideoCommentThread, | 8 | addVideoCommentThread, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | createVideoPlaylist, | 10 | createVideoPlaylist, |
12 | doubleFollow, | 11 | doubleFollow, |
13 | flushAndRunMultipleServers, | 12 | flushAndRunMultipleServers, |
@@ -156,7 +155,7 @@ describe('Test plugin filter hooks', function () { | |||
156 | channelId: servers[0].videoChannel.id | 155 | channelId: servers[0].videoChannel.id |
157 | } | 156 | } |
158 | 157 | ||
159 | await createLive(servers[0].url, servers[0].accessToken, attributes, HttpStatusCode.FORBIDDEN_403) | 158 | await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
160 | }) | 159 | }) |
161 | 160 | ||
162 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { | 161 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 71c2adc72..65282419e 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -7,18 +7,15 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server | |||
7 | import { | 7 | import { |
8 | buildServerDirectory, | 8 | buildServerDirectory, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | createLive, | ||
11 | flushAndRunServer, | 10 | flushAndRunServer, |
12 | getVideo, | 11 | getVideo, |
13 | PluginsCommand, | 12 | PluginsCommand, |
14 | sendRTMPStreamInVideo, | ||
15 | ServerInfo, | 13 | ServerInfo, |
16 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
17 | setDefaultVideoChannel, | 15 | setDefaultVideoChannel, |
18 | testFfmpegStreamError, | 16 | testFfmpegStreamError, |
19 | uploadVideoAndGetId, | 17 | uploadVideoAndGetId, |
20 | waitJobs, | 18 | waitJobs |
21 | waitUntilLivePublished | ||
22 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
23 | import { VideoDetails, VideoPrivacy } from '@shared/models' | 20 | import { VideoDetails, VideoPrivacy } from '@shared/models' |
24 | 21 | ||
@@ -29,8 +26,9 @@ async function createLiveWrapper (server: ServerInfo) { | |||
29 | privacy: VideoPrivacy.PUBLIC | 26 | privacy: VideoPrivacy.PUBLIC |
30 | } | 27 | } |
31 | 28 | ||
32 | const res = await createLive(server.url, server.accessToken, liveAttributes) | 29 | const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes }) |
33 | return res.body.video.uuid | 30 | |
31 | return uuid | ||
34 | } | 32 | } |
35 | 33 | ||
36 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { | 34 | function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { |
@@ -171,8 +169,8 @@ describe('Test transcoding plugins', function () { | |||
171 | 169 | ||
172 | const liveVideoId = await createLiveWrapper(server) | 170 | const liveVideoId = await createLiveWrapper(server) |
173 | 171 | ||
174 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 172 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
175 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 173 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
176 | await waitJobs([ server ]) | 174 | await waitJobs([ server ]) |
177 | 175 | ||
178 | await checkLiveFPS(liveVideoId, 'above', 20) | 176 | await checkLiveFPS(liveVideoId, 'above', 20) |
@@ -185,8 +183,8 @@ describe('Test transcoding plugins', function () { | |||
185 | 183 | ||
186 | const liveVideoId = await createLiveWrapper(server) | 184 | const liveVideoId = await createLiveWrapper(server) |
187 | 185 | ||
188 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 186 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
189 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 187 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
190 | await waitJobs([ server ]) | 188 | await waitJobs([ server ]) |
191 | 189 | ||
192 | await checkLiveFPS(liveVideoId, 'below', 12) | 190 | await checkLiveFPS(liveVideoId, 'below', 12) |
@@ -199,8 +197,8 @@ describe('Test transcoding plugins', function () { | |||
199 | 197 | ||
200 | const liveVideoId = await createLiveWrapper(server) | 198 | const liveVideoId = await createLiveWrapper(server) |
201 | 199 | ||
202 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 200 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
203 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 201 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
204 | await waitJobs([ server ]) | 202 | await waitJobs([ server ]) |
205 | 203 | ||
206 | await checkLiveFPS(liveVideoId, 'below', 6) | 204 | await checkLiveFPS(liveVideoId, 'below', 6) |
@@ -213,7 +211,7 @@ describe('Test transcoding plugins', function () { | |||
213 | 211 | ||
214 | const liveVideoId = await createLiveWrapper(server) | 212 | const liveVideoId = await createLiveWrapper(server) |
215 | 213 | ||
216 | const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 214 | const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
217 | await testFfmpegStreamError(command, true) | 215 | await testFfmpegStreamError(command, true) |
218 | }) | 216 | }) |
219 | 217 | ||
@@ -262,8 +260,8 @@ describe('Test transcoding plugins', function () { | |||
262 | 260 | ||
263 | const liveVideoId = await createLiveWrapper(server) | 261 | const liveVideoId = await createLiveWrapper(server) |
264 | 262 | ||
265 | await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') | 263 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
266 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) | 264 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) |
267 | await waitJobs([ server ]) | 265 | await waitJobs([ server ]) |
268 | 266 | ||
269 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` | 267 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` |