diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-18 14:44:12 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-02-19 09:36:50 +0100 |
commit | fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8 (patch) | |
tree | 38df5942cb2fa6e5860c8e0e19471eb6b124e291 /server/tests/api/live/live.ts | |
parent | 3f8ae0e4e4da90c964597e4b3e0724da5eaa1668 (diff) | |
download | PeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.tar.gz PeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.tar.zst PeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.zip |
Try to speed up server tests
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r-- | server/tests/api/live/live.ts | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index ff822f84d..19976ba8a 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -50,6 +50,12 @@ const expect = chai.expect | |||
50 | describe('Test live', function () { | 50 | describe('Test live', function () { |
51 | let servers: ServerInfo[] = [] | 51 | let servers: ServerInfo[] = [] |
52 | 52 | ||
53 | async function waitUntilLivePublishedOnAllServers (videoId: string) { | ||
54 | for (const server of servers) { | ||
55 | await waitUntilLivePublished(server.url, server.accessToken, videoId) | ||
56 | } | ||
57 | } | ||
58 | |||
53 | before(async function () { | 59 | before(async function () { |
54 | this.timeout(120000) | 60 | this.timeout(120000) |
55 | 61 | ||
@@ -390,7 +396,7 @@ describe('Test live', function () { | |||
390 | liveVideoId = await createLiveWrapper(false) | 396 | liveVideoId = await createLiveWrapper(false) |
391 | 397 | ||
392 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 398 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
393 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 399 | await waitUntilLivePublishedOnAllServers(liveVideoId) |
394 | await waitJobs(servers) | 400 | await waitJobs(servers) |
395 | 401 | ||
396 | await testVideoResolutions(liveVideoId, [ 720 ]) | 402 | await testVideoResolutions(liveVideoId, [ 720 ]) |
@@ -406,7 +412,7 @@ describe('Test live', function () { | |||
406 | liveVideoId = await createLiveWrapper(false) | 412 | liveVideoId = await createLiveWrapper(false) |
407 | 413 | ||
408 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 414 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
409 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 415 | await waitUntilLivePublishedOnAllServers(liveVideoId) |
410 | await waitJobs(servers) | 416 | await waitJobs(servers) |
411 | 417 | ||
412 | await testVideoResolutions(liveVideoId, resolutions) | 418 | await testVideoResolutions(liveVideoId, resolutions) |
@@ -423,7 +429,7 @@ describe('Test live', function () { | |||
423 | liveVideoId = await createLiveWrapper(true) | 429 | liveVideoId = await createLiveWrapper(true) |
424 | 430 | ||
425 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') | 431 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') |
426 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 432 | await waitUntilLivePublishedOnAllServers(liveVideoId) |
427 | await waitJobs(servers) | 433 | await waitJobs(servers) |
428 | 434 | ||
429 | await testVideoResolutions(liveVideoId, resolutions) | 435 | await testVideoResolutions(liveVideoId, resolutions) |
@@ -433,7 +439,7 @@ describe('Test live', function () { | |||
433 | 439 | ||
434 | await waitJobs(servers) | 440 | await waitJobs(servers) |
435 | 441 | ||
436 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 442 | await waitUntilLivePublishedOnAllServers(liveVideoId) |
437 | 443 | ||
438 | const bitrateLimits = { | 444 | const bitrateLimits = { |
439 | 720: 5000 * 1000, // 60FPS | 445 | 720: 5000 * 1000, // 60FPS |
@@ -514,7 +520,7 @@ describe('Test live', function () { | |||
514 | liveVideoId = res.body.video.uuid | 520 | liveVideoId = res.body.video.uuid |
515 | 521 | ||
516 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | 522 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) |
517 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) | 523 | await waitUntilLivePublishedOnAllServers(liveVideoId) |
518 | await waitJobs(servers) | 524 | await waitJobs(servers) |
519 | }) | 525 | }) |
520 | 526 | ||
@@ -602,10 +608,7 @@ describe('Test live', function () { | |||
602 | 608 | ||
603 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 609 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
604 | 610 | ||
605 | for (const server of servers) { | 611 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
606 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID) | ||
607 | } | ||
608 | |||
609 | await waitJobs(servers) | 612 | await waitJobs(servers) |
610 | 613 | ||
611 | for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { | 614 | for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { |
@@ -618,7 +621,6 @@ describe('Test live', function () { | |||
618 | for (const server of servers) { | 621 | for (const server of servers) { |
619 | await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) | 622 | await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) |
620 | } | 623 | } |
621 | |||
622 | await waitJobs(servers) | 624 | await waitJobs(servers) |
623 | 625 | ||
624 | for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { | 626 | for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { |
@@ -654,10 +656,7 @@ describe('Test live', function () { | |||
654 | 656 | ||
655 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 657 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
656 | 658 | ||
657 | for (const server of servers) { | 659 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) |
658 | await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID) | ||
659 | } | ||
660 | |||
661 | await waitJobs(servers) | 660 | await waitJobs(servers) |
662 | 661 | ||
663 | expect(localLastVideoViews).to.equal(0) | 662 | expect(localLastVideoViews).to.equal(0) |
@@ -691,7 +690,8 @@ describe('Test live', function () { | |||
691 | socket.emit('subscribe', { videoId }) | 690 | socket.emit('subscribe', { videoId }) |
692 | 691 | ||
693 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) | 692 | const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) |
694 | await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) | 693 | |
694 | await waitUntilLivePublishedOnAllServers(liveVideoUUID) | ||
695 | await waitJobs(servers) | 695 | await waitJobs(servers) |
696 | 696 | ||
697 | expect(stateChanges).to.have.lengthOf(1) | 697 | expect(stateChanges).to.have.lengthOf(1) |