aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/multiple-servers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r--server/tests/api/videos/multiple-servers.ts39
1 files changed, 20 insertions, 19 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index edc46a644..cb18898ce 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -15,7 +15,8 @@ import {
15 dateIsValid, 15 dateIsValid,
16 doubleFollow, 16 doubleFollow,
17 flushAndRunMultipleServers, 17 flushAndRunMultipleServers,
18 flushTests, getLocalVideos, 18 flushTests,
19 getLocalVideos,
19 getVideo, 20 getVideo,
20 getVideoChannelsList, 21 getVideoChannelsList,
21 getVideosList, 22 getVideosList,
@@ -39,7 +40,7 @@ import {
39 getVideoCommentThreads, 40 getVideoCommentThreads,
40 getVideoThreadComments 41 getVideoThreadComments
41} from '../../utils/videos/video-comments' 42} from '../../utils/videos/video-comments'
42import { getAccountsList } from '../../utils/users/accounts' 43import { waitJobs } from '../../utils/server/jobs'
43 44
44const expect = chai.expect 45const expect = chai.expect
45 46
@@ -102,7 +103,7 @@ describe('Test multiple servers', function () {
102 } 103 }
103 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) 104 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
104 105
105 await wait(10000) 106 await waitJobs(servers)
106 107
107 // All servers should have this video 108 // All servers should have this video
108 let publishedAt: string = null 109 let publishedAt: string = null
@@ -177,7 +178,7 @@ describe('Test multiple servers', function () {
177 await uploadVideo(servers[1].url, userAccessToken, videoAttributes) 178 await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
178 179
179 // Transcoding 180 // Transcoding
180 await wait(30000) 181 await waitJobs(servers)
181 182
182 // All servers should have this video 183 // All servers should have this video
183 for (const server of servers) { 184 for (const server of servers) {
@@ -266,7 +267,7 @@ describe('Test multiple servers', function () {
266 } 267 }
267 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2) 268 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
268 269
269 await wait(10000) 270 await waitJobs(servers)
270 271
271 // All servers should have this video 272 // All servers should have this video
272 for (const server of servers) { 273 for (const server of servers) {
@@ -496,15 +497,15 @@ describe('Test multiple servers', function () {
496 await viewVideo(servers[2].url, localVideosServer3[1]) 497 await viewVideo(servers[2].url, localVideosServer3[1])
497 498
498 await Promise.all(tasks) 499 await Promise.all(tasks)
499 await wait(1500) 500 await waitJobs(servers)
500 501
501 await viewVideo(servers[2].url, localVideosServer3[0]) 502 await viewVideo(servers[2].url, localVideosServer3[0])
502 503
503 await wait(1500) 504 await waitJobs(servers)
504 505
505 await viewVideo(servers[2].url, localVideosServer3[0]) 506 await viewVideo(servers[2].url, localVideosServer3[0])
506 507
507 await wait(5000) 508 await waitJobs(servers)
508 509
509 for (const server of servers) { 510 for (const server of servers) {
510 const res = await getVideosList(server.url) 511 const res = await getVideosList(server.url)
@@ -535,7 +536,7 @@ describe('Test multiple servers', function () {
535 536
536 await Promise.all(tasks) 537 await Promise.all(tasks)
537 538
538 await wait(10000) 539 await waitJobs(servers)
539 540
540 let baseVideos = null 541 let baseVideos = null
541 542
@@ -572,7 +573,7 @@ describe('Test multiple servers', function () {
572 await wait(200) 573 await wait(200)
573 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like') 574 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like')
574 575
575 await wait(10000) 576 await waitJobs(servers)
576 577
577 let baseVideos = null 578 let baseVideos = null
578 for (const server of servers) { 579 for (const server of servers) {
@@ -614,7 +615,7 @@ describe('Test multiple servers', function () {
614 615
615 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes) 616 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
616 617
617 await wait(5000) 618 await waitJobs(servers)
618 }) 619 })
619 620
620 it('Should have the video 3 updated on each server', async function () { 621 it('Should have the video 3 updated on each server', async function () {
@@ -670,7 +671,7 @@ describe('Test multiple servers', function () {
670 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id) 671 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
671 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id) 672 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
672 673
673 await wait(5000) 674 await waitJobs(servers)
674 }) 675 })
675 676
676 it('Should not have files of videos 3 and 3-2 on each server', async function () { 677 it('Should not have files of videos 3 and 3-2 on each server', async function () {
@@ -749,7 +750,7 @@ describe('Test multiple servers', function () {
749 await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text) 750 await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text)
750 } 751 }
751 752
752 await wait(5000) 753 await waitJobs(servers)
753 754
754 { 755 {
755 const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5) 756 const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5)
@@ -759,7 +760,7 @@ describe('Test multiple servers', function () {
759 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text) 760 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text)
760 } 761 }
761 762
762 await wait(5000) 763 await waitJobs(servers)
763 764
764 { 765 {
765 const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5) 766 const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5)
@@ -775,7 +776,7 @@ describe('Test multiple servers', function () {
775 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2) 776 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2)
776 } 777 }
777 778
778 await wait(5000) 779 await waitJobs(servers)
779 }) 780 })
780 781
781 it('Should have these threads', async function () { 782 it('Should have these threads', async function () {
@@ -848,7 +849,7 @@ describe('Test multiple servers', function () {
848 849
849 await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id) 850 await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id)
850 851
851 await wait(5000) 852 await waitJobs(servers)
852 }) 853 })
853 854
854 it('Should not have this comment anymore', async function () { 855 it('Should not have this comment anymore', async function () {
@@ -877,7 +878,7 @@ describe('Test multiple servers', function () {
877 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id 878 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
878 await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId) 879 await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)
879 880
880 await wait(5000) 881 await waitJobs(servers)
881 }) 882 })
882 883
883 it('Should have the thread comments deleted on other servers too', async function () { 884 it('Should have the thread comments deleted on other servers too', async function () {
@@ -910,7 +911,7 @@ describe('Test multiple servers', function () {
910 911
911 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes) 912 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
912 913
913 await wait(5000) 914 await waitJobs(servers)
914 915
915 for (const server of servers) { 916 for (const server of servers) {
916 const res = await getVideo(server.url, videoUUID) 917 const res = await getVideo(server.url, videoUUID)
@@ -941,7 +942,7 @@ describe('Test multiple servers', function () {
941 await req.attach('videofile', filePath) 942 await req.attach('videofile', filePath)
942 .expect(200) 943 .expect(200)
943 944
944 await wait(40000) 945 await waitJobs(servers)
945 946
946 for (const server of servers) { 947 for (const server of servers) {
947 const res = await getVideosList(server.url) 948 const res = await getVideosList(server.url)