diff options
Diffstat (limited to 'server/tests/api/redundancy/redundancy.ts')
-rw-r--r-- | server/tests/api/redundancy/redundancy.ts | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 1960854b6..47f4e59fc 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -54,7 +54,7 @@ async function runServers (strategy: VideoRedundancyStrategy, additionalParams: | |||
54 | immutableAssign({ | 54 | immutableAssign({ |
55 | min_lifetime: '1 hour', | 55 | min_lifetime: '1 hour', |
56 | strategy: strategy, | 56 | strategy: strategy, |
57 | size: '100KB' | 57 | size: '200KB' |
58 | }, additionalParams) | 58 | }, additionalParams) |
59 | ] | 59 | ] |
60 | } | 60 | } |
@@ -111,8 +111,8 @@ async function checkStatsWith2Webseed (strategy: VideoRedundancyStrategy) { | |||
111 | const stat = data.videosRedundancy[0] | 111 | const stat = data.videosRedundancy[0] |
112 | 112 | ||
113 | expect(stat.strategy).to.equal(strategy) | 113 | expect(stat.strategy).to.equal(strategy) |
114 | expect(stat.totalSize).to.equal(102400) | 114 | expect(stat.totalSize).to.equal(204800) |
115 | expect(stat.totalUsed).to.be.at.least(1).and.below(102401) | 115 | expect(stat.totalUsed).to.be.at.least(1).and.below(204801) |
116 | expect(stat.totalVideoFiles).to.equal(4) | 116 | expect(stat.totalVideoFiles).to.equal(4) |
117 | expect(stat.totalVideos).to.equal(1) | 117 | expect(stat.totalVideos).to.equal(1) |
118 | } | 118 | } |
@@ -125,7 +125,7 @@ async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategy) { | |||
125 | 125 | ||
126 | const stat = data.videosRedundancy[0] | 126 | const stat = data.videosRedundancy[0] |
127 | expect(stat.strategy).to.equal(strategy) | 127 | expect(stat.strategy).to.equal(strategy) |
128 | expect(stat.totalSize).to.equal(102400) | 128 | expect(stat.totalSize).to.equal(204800) |
129 | expect(stat.totalUsed).to.equal(0) | 129 | expect(stat.totalUsed).to.equal(0) |
130 | expect(stat.totalVideoFiles).to.equal(0) | 130 | expect(stat.totalVideoFiles).to.equal(0) |
131 | expect(stat.totalVideos).to.equal(0) | 131 | expect(stat.totalVideos).to.equal(0) |
@@ -223,7 +223,7 @@ describe('Test videos redundancy', function () { | |||
223 | return enableRedundancyOnServer1() | 223 | return enableRedundancyOnServer1() |
224 | }) | 224 | }) |
225 | 225 | ||
226 | it('Should have 2 webseed on the first video', async function () { | 226 | it('Should have 2 webseeds on the first video', async function () { |
227 | this.timeout(40000) | 227 | this.timeout(40000) |
228 | 228 | ||
229 | await waitJobs(servers) | 229 | await waitJobs(servers) |
@@ -270,7 +270,7 @@ describe('Test videos redundancy', function () { | |||
270 | return enableRedundancyOnServer1() | 270 | return enableRedundancyOnServer1() |
271 | }) | 271 | }) |
272 | 272 | ||
273 | it('Should have 2 webseed on the first video', async function () { | 273 | it('Should have 2 webseeds on the first video', async function () { |
274 | this.timeout(40000) | 274 | this.timeout(40000) |
275 | 275 | ||
276 | await waitJobs(servers) | 276 | await waitJobs(servers) |
@@ -338,7 +338,7 @@ describe('Test videos redundancy', function () { | |||
338 | await waitJobs(servers) | 338 | await waitJobs(servers) |
339 | }) | 339 | }) |
340 | 340 | ||
341 | it('Should have 2 webseed on the first video', async function () { | 341 | it('Should have 2 webseeds on the first video', async function () { |
342 | this.timeout(40000) | 342 | this.timeout(40000) |
343 | 343 | ||
344 | await waitJobs(servers) | 344 | await waitJobs(servers) |
@@ -419,7 +419,7 @@ describe('Test videos redundancy', function () { | |||
419 | 419 | ||
420 | killallServers([ servers[0] ]) | 420 | killallServers([ servers[0] ]) |
421 | 421 | ||
422 | await wait(10000) | 422 | await wait(15000) |
423 | 423 | ||
424 | await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001') | 424 | await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001') |
425 | }) | 425 | }) |
@@ -451,27 +451,23 @@ describe('Test videos redundancy', function () { | |||
451 | video2Server2UUID = res.body.video.uuid | 451 | video2Server2UUID = res.body.video.uuid |
452 | }) | 452 | }) |
453 | 453 | ||
454 | it('Should cache video 2 webseed on the first video', async function () { | 454 | it('Should cache video 2 webseeds on the first video', async function () { |
455 | this.timeout(50000) | 455 | this.timeout(120000) |
456 | 456 | ||
457 | await waitJobs(servers) | 457 | await waitJobs(servers) |
458 | 458 | ||
459 | await wait(7000) | 459 | let checked = false |
460 | 460 | ||
461 | try { | 461 | while (checked === false) { |
462 | await check1WebSeed(strategy, video1Server2UUID) | 462 | await wait(1000) |
463 | await check2Webseeds(strategy, video2Server2UUID) | ||
464 | } catch { | ||
465 | await wait(3000) | ||
466 | 463 | ||
467 | try { | 464 | try { |
468 | await check1WebSeed(strategy, video1Server2UUID) | 465 | await check1WebSeed(strategy, video1Server2UUID) |
469 | await check2Webseeds(strategy, video2Server2UUID) | 466 | await check2Webseeds(strategy, video2Server2UUID) |
470 | } catch { | ||
471 | await wait(5000) | ||
472 | 467 | ||
473 | await check1WebSeed(strategy, video1Server2UUID) | 468 | checked = true |
474 | await check2Webseeds(strategy, video2Server2UUID) | 469 | } catch { |
470 | checked = false | ||
475 | } | 471 | } |
476 | } | 472 | } |
477 | }) | 473 | }) |