diff options
Diffstat (limited to 'server/tests/api/redundancy/redundancy.ts')
-rw-r--r-- | server/tests/api/redundancy/redundancy.ts | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index f5bf130d5..c5037a541 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
@@ -92,21 +92,21 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, add | |||
92 | await setAccessTokensToServers(servers) | 92 | await setAccessTokensToServers(servers) |
93 | 93 | ||
94 | { | 94 | { |
95 | const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' }) | 95 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' }) |
96 | video1Server2UUID = res.body.video.uuid | 96 | video1Server2UUID = res.body.video.uuid |
97 | video1Server2Id = res.body.video.id | 97 | video1Server2Id = res.body.video.id |
98 | 98 | ||
99 | await viewVideo(servers[ 1 ].url, video1Server2UUID) | 99 | await viewVideo(servers[1].url, video1Server2UUID) |
100 | } | 100 | } |
101 | 101 | ||
102 | await waitJobs(servers) | 102 | await waitJobs(servers) |
103 | 103 | ||
104 | // Server 1 and server 2 follow each other | 104 | // Server 1 and server 2 follow each other |
105 | await doubleFollow(servers[ 0 ], servers[ 1 ]) | 105 | await doubleFollow(servers[0], servers[1]) |
106 | // Server 1 and server 3 follow each other | 106 | // Server 1 and server 3 follow each other |
107 | await doubleFollow(servers[ 0 ], servers[ 2 ]) | 107 | await doubleFollow(servers[0], servers[2]) |
108 | // Server 2 and server 3 follow each other | 108 | // Server 2 and server 3 follow each other |
109 | await doubleFollow(servers[ 1 ], servers[ 2 ]) | 109 | await doubleFollow(servers[1], servers[2]) |
110 | 110 | ||
111 | await waitJobs(servers) | 111 | await waitJobs(servers) |
112 | } | 112 | } |
@@ -115,7 +115,7 @@ async function check1WebSeed (videoUUID?: string) { | |||
115 | if (!videoUUID) videoUUID = video1Server2UUID | 115 | if (!videoUUID) videoUUID = video1Server2UUID |
116 | 116 | ||
117 | const webseeds = [ | 117 | const webseeds = [ |
118 | `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}` | 118 | `http://localhost:${servers[1].port}/static/webseed/${videoUUID}` |
119 | ] | 119 | ] |
120 | 120 | ||
121 | for (const server of servers) { | 121 | for (const server of servers) { |
@@ -133,8 +133,8 @@ async function check2Webseeds (videoUUID?: string) { | |||
133 | if (!videoUUID) videoUUID = video1Server2UUID | 133 | if (!videoUUID) videoUUID = video1Server2UUID |
134 | 134 | ||
135 | const webseeds = [ | 135 | const webseeds = [ |
136 | `http://localhost:${servers[ 0 ].port}/static/redundancy/${videoUUID}`, | 136 | `http://localhost:${servers[0].port}/static/redundancy/${videoUUID}`, |
137 | `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}` | 137 | `http://localhost:${servers[1].port}/static/webseed/${videoUUID}` |
138 | ] | 138 | ] |
139 | 139 | ||
140 | for (const server of servers) { | 140 | for (const server of servers) { |
@@ -269,12 +269,12 @@ async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategyWithManu | |||
269 | } | 269 | } |
270 | 270 | ||
271 | async function enableRedundancyOnServer1 () { | 271 | async function enableRedundancyOnServer1 () { |
272 | await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true) | 272 | await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true) |
273 | 273 | ||
274 | const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' }) | 274 | const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' }) |
275 | const follows: ActorFollow[] = res.body.data | 275 | const follows: ActorFollow[] = res.body.data |
276 | const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`) | 276 | const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) |
277 | const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`) | 277 | const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) |
278 | 278 | ||
279 | expect(server3).to.not.be.undefined | 279 | expect(server3).to.not.be.undefined |
280 | expect(server3.following.hostRedundancyAllowed).to.be.false | 280 | expect(server3.following.hostRedundancyAllowed).to.be.false |
@@ -284,12 +284,12 @@ async function enableRedundancyOnServer1 () { | |||
284 | } | 284 | } |
285 | 285 | ||
286 | async function disableRedundancyOnServer1 () { | 286 | async function disableRedundancyOnServer1 () { |
287 | await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, false) | 287 | await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, false) |
288 | 288 | ||
289 | const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' }) | 289 | const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' }) |
290 | const follows: ActorFollow[] = res.body.data | 290 | const follows: ActorFollow[] = res.body.data |
291 | const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`) | 291 | const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`) |
292 | const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`) | 292 | const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`) |
293 | 293 | ||
294 | expect(server3).to.not.be.undefined | 294 | expect(server3).to.not.be.undefined |
295 | expect(server3.following.hostRedundancyAllowed).to.be.false | 295 | expect(server3.following.hostRedundancyAllowed).to.be.false |
@@ -434,8 +434,8 @@ describe('Test videos redundancy', function () { | |||
434 | it('Should view 2 times the first video to have > min_views config', async function () { | 434 | it('Should view 2 times the first video to have > min_views config', async function () { |
435 | this.timeout(80000) | 435 | this.timeout(80000) |
436 | 436 | ||
437 | await viewVideo(servers[ 0 ].url, video1Server2UUID) | 437 | await viewVideo(servers[0].url, video1Server2UUID) |
438 | await viewVideo(servers[ 2 ].url, video1Server2UUID) | 438 | await viewVideo(servers[2].url, video1Server2UUID) |
439 | 439 | ||
440 | await wait(10000) | 440 | await wait(10000) |
441 | await waitJobs(servers) | 441 | await waitJobs(servers) |
@@ -620,7 +620,7 @@ describe('Test videos redundancy', function () { | |||
620 | await check1PlaylistRedundancies() | 620 | await check1PlaylistRedundancies() |
621 | await checkStatsWith2Webseed(strategy) | 621 | await checkStatsWith2Webseed(strategy) |
622 | 622 | ||
623 | const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' }) | 623 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' }) |
624 | video2Server2UUID = res.body.video.uuid | 624 | video2Server2UUID = res.body.video.uuid |
625 | }) | 625 | }) |
626 | 626 | ||
@@ -652,8 +652,8 @@ describe('Test videos redundancy', function () { | |||
652 | 652 | ||
653 | await waitJobs(servers) | 653 | await waitJobs(servers) |
654 | 654 | ||
655 | killallServers([ servers[ 0 ] ]) | 655 | killallServers([ servers[0] ]) |
656 | await reRunServer(servers[ 0 ], { | 656 | await reRunServer(servers[0], { |
657 | redundancy: { | 657 | redundancy: { |
658 | videos: { | 658 | videos: { |
659 | check_interval: '1 second', | 659 | check_interval: '1 second', |