aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/redundancy
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 09:43:59 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit6c5065a011b099618681a37bd77eaa7bd3db752e (patch)
tree352252a00b25013c4b1902f6bcd9668aba295c7b /server/tests/api/redundancy
parent0d8ecb7592577f54012413a2b5a9b159cfc90399 (diff)
downloadPeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.gz
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.zst
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.zip
Introduce server commands
Diffstat (limited to 'server/tests/api/redundancy')
-rw-r--r--server/tests/api/redundancy/manage-redundancy.ts7
-rw-r--r--server/tests/api/redundancy/redundancy-constraints.ts11
-rw-r--r--server/tests/api/redundancy/redundancy.ts36
3 files changed, 26 insertions, 28 deletions
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts
index 363e4cbfe..03857f512 100644
--- a/server/tests/api/redundancy/manage-redundancy.ts
+++ b/server/tests/api/redundancy/manage-redundancy.ts
@@ -12,8 +12,7 @@ import {
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo, 13 uploadVideo,
14 uploadVideoAndGetId, 14 uploadVideoAndGetId,
15 waitJobs, 15 waitJobs
16 waitUntilLog
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18import { VideoPrivacy, VideoRedundanciesTarget } from '@shared/models' 17import { VideoPrivacy, VideoRedundanciesTarget } from '@shared/models'
19 18
@@ -91,7 +90,7 @@ describe('Test manage videos redundancy', function () {
91 this.timeout(120000) 90 this.timeout(120000)
92 91
93 await waitJobs(servers) 92 await waitJobs(servers)
94 await waitUntilLog(servers[0], 'Duplicated ', 10) 93 await servers[0].serversCommand.waitUntilLog('Duplicated ', 10)
95 await waitJobs(servers) 94 await waitJobs(servers)
96 95
97 const body = await commands[1].listVideos({ target: 'remote-videos' }) 96 const body = await commands[1].listVideos({ target: 'remote-videos' })
@@ -214,7 +213,7 @@ describe('Test manage videos redundancy', function () {
214 await commands[0].addVideo({ videoId }) 213 await commands[0].addVideo({ videoId })
215 214
216 await waitJobs(servers) 215 await waitJobs(servers)
217 await waitUntilLog(servers[0], 'Duplicated ', 15) 216 await servers[0].serversCommand.waitUntilLog('Duplicated ', 15)
218 await waitJobs(servers) 217 await waitJobs(servers)
219 218
220 { 219 {
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts
index 82d952471..a31278de7 100644
--- a/server/tests/api/redundancy/redundancy-constraints.ts
+++ b/server/tests/api/redundancy/redundancy-constraints.ts
@@ -11,8 +11,7 @@ import {
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 updateVideo, 12 updateVideo,
13 uploadVideo, 13 uploadVideo,
14 waitJobs, 14 waitJobs
15 waitUntilLog
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { VideoPrivacy } from '@shared/models' 16import { VideoPrivacy } from '@shared/models'
18 17
@@ -97,7 +96,7 @@ describe('Test redundancy constraints', function () {
97 this.timeout(120000) 96 this.timeout(120000)
98 97
99 await waitJobs(servers) 98 await waitJobs(servers)
100 await waitUntilLog(remoteServer, 'Duplicated ', 5) 99 await remoteServer.serversCommand.waitUntilLog('Duplicated ', 5)
101 await waitJobs(servers) 100 await waitJobs(servers)
102 101
103 { 102 {
@@ -126,7 +125,7 @@ describe('Test redundancy constraints', function () {
126 125
127 await uploadWrapper('video 2 server 2') 126 await uploadWrapper('video 2 server 2')
128 127
129 await waitUntilLog(remoteServer, 'Duplicated ', 10) 128 await remoteServer.serversCommand.waitUntilLog('Duplicated ', 10)
130 await waitJobs(servers) 129 await waitJobs(servers)
131 130
132 { 131 {
@@ -155,7 +154,7 @@ describe('Test redundancy constraints', function () {
155 154
156 await uploadWrapper('video 3 server 2') 155 await uploadWrapper('video 3 server 2')
157 156
158 await waitUntilLog(remoteServer, 'Duplicated ', 15) 157 await remoteServer.serversCommand.waitUntilLog('Duplicated ', 15)
159 await waitJobs(servers) 158 await waitJobs(servers)
160 159
161 { 160 {
@@ -176,7 +175,7 @@ describe('Test redundancy constraints', function () {
176 await waitJobs(servers) 175 await waitJobs(servers)
177 176
178 await uploadWrapper('video 4 server 2') 177 await uploadWrapper('video 4 server 2')
179 await waitUntilLog(remoteServer, 'Duplicated ', 20) 178 await remoteServer.serversCommand.waitUntilLog('Duplicated ', 20)
180 await waitJobs(servers) 179 await waitJobs(servers)
181 180
182 { 181 {
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 56a2af395..00a5e86cc 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -14,7 +14,6 @@ import {
14 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
15 getVideo, 15 getVideo,
16 getVideoWithToken, 16 getVideoWithToken,
17 immutableAssign,
18 killallServers, 17 killallServers,
19 makeGetRequest, 18 makeGetRequest,
20 removeVideo, 19 removeVideo,
@@ -26,8 +25,7 @@ import {
26 uploadVideo, 25 uploadVideo,
27 viewVideo, 26 viewVideo,
28 wait, 27 wait,
29 waitJobs, 28 waitJobs
30 waitUntilLog
31} from '@shared/extra-utils' 29} from '@shared/extra-utils'
32import { VideoDetails, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' 30import { VideoDetails, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
33 31
@@ -53,11 +51,13 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, add
53 51
54 if (strategy !== null) { 52 if (strategy !== null) {
55 strategies.push( 53 strategies.push(
56 immutableAssign({ 54 {
57 min_lifetime: '1 hour', 55 min_lifetime: '1 hour',
58 strategy: strategy, 56 strategy: strategy,
59 size: '400KB' 57 size: '400KB',
60 }, additionalParams) 58
59 ...additionalParams
60 }
61 ) 61 )
62 } 62 }
63 63
@@ -316,7 +316,7 @@ describe('Test videos redundancy', function () {
316 this.timeout(80000) 316 this.timeout(80000)
317 317
318 await waitJobs(servers) 318 await waitJobs(servers)
319 await waitUntilLog(servers[0], 'Duplicated ', 5) 319 await servers[0].serversCommand.waitUntilLog('Duplicated ', 5)
320 await waitJobs(servers) 320 await waitJobs(servers)
321 321
322 await check2Webseeds() 322 await check2Webseeds()
@@ -335,7 +335,7 @@ describe('Test videos redundancy', function () {
335 await check1WebSeed() 335 await check1WebSeed()
336 await check0PlaylistRedundancies() 336 await check0PlaylistRedundancies()
337 337
338 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].internalServerNumber, [ 'videos', join('playlists', 'hls') ]) 338 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0], [ 'videos', join('playlists', 'hls') ])
339 }) 339 })
340 340
341 after(async function () { 341 after(async function () {
@@ -366,7 +366,7 @@ describe('Test videos redundancy', function () {
366 this.timeout(80000) 366 this.timeout(80000)
367 367
368 await waitJobs(servers) 368 await waitJobs(servers)
369 await waitUntilLog(servers[0], 'Duplicated ', 5) 369 await servers[0].serversCommand.waitUntilLog('Duplicated ', 5)
370 await waitJobs(servers) 370 await waitJobs(servers)
371 371
372 await check2Webseeds() 372 await check2Webseeds()
@@ -385,7 +385,7 @@ describe('Test videos redundancy', function () {
385 await check1WebSeed() 385 await check1WebSeed()
386 await check0PlaylistRedundancies() 386 await check0PlaylistRedundancies()
387 387
388 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].internalServerNumber, [ 'videos' ]) 388 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0], [ 'videos' ])
389 }) 389 })
390 390
391 after(async function () { 391 after(async function () {
@@ -438,7 +438,7 @@ describe('Test videos redundancy', function () {
438 this.timeout(80000) 438 this.timeout(80000)
439 439
440 await waitJobs(servers) 440 await waitJobs(servers)
441 await waitUntilLog(servers[0], 'Duplicated ', 5) 441 await servers[0].serversCommand.waitUntilLog('Duplicated ', 5)
442 await waitJobs(servers) 442 await waitJobs(servers)
443 443
444 await check2Webseeds() 444 await check2Webseeds()
@@ -454,7 +454,7 @@ describe('Test videos redundancy', function () {
454 await waitJobs(servers) 454 await waitJobs(servers)
455 455
456 for (const server of servers) { 456 for (const server of servers) {
457 await checkVideoFilesWereRemoved(video1Server2UUID, server.internalServerNumber) 457 await checkVideoFilesWereRemoved(video1Server2UUID, server)
458 } 458 }
459 }) 459 })
460 460
@@ -502,7 +502,7 @@ describe('Test videos redundancy', function () {
502 await waitJobs(servers) 502 await waitJobs(servers)
503 503
504 await waitJobs(servers) 504 await waitJobs(servers)
505 await waitUntilLog(servers[0], 'Duplicated ', 1) 505 await servers[0].serversCommand.waitUntilLog('Duplicated ', 1)
506 await waitJobs(servers) 506 await waitJobs(servers)
507 507
508 await check1PlaylistRedundancies() 508 await check1PlaylistRedundancies()
@@ -517,7 +517,7 @@ describe('Test videos redundancy', function () {
517 await waitJobs(servers) 517 await waitJobs(servers)
518 518
519 for (const server of servers) { 519 for (const server of servers) {
520 await checkVideoFilesWereRemoved(video1Server2UUID, server.internalServerNumber) 520 await checkVideoFilesWereRemoved(video1Server2UUID, server)
521 } 521 }
522 }) 522 })
523 523
@@ -547,7 +547,7 @@ describe('Test videos redundancy', function () {
547 this.timeout(80000) 547 this.timeout(80000)
548 548
549 await waitJobs(servers) 549 await waitJobs(servers)
550 await waitUntilLog(servers[0], 'Duplicated ', 5) 550 await servers[0].serversCommand.waitUntilLog('Duplicated ', 5)
551 await waitJobs(servers) 551 await waitJobs(servers)
552 552
553 await check2Webseeds() 553 await check2Webseeds()
@@ -575,7 +575,7 @@ describe('Test videos redundancy', function () {
575 await check1WebSeed() 575 await check1WebSeed()
576 await check0PlaylistRedundancies() 576 await check0PlaylistRedundancies()
577 577
578 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ]) 578 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0], [ 'videos' ])
579 }) 579 })
580 580
581 after(async function () { 581 after(async function () {
@@ -658,7 +658,7 @@ describe('Test videos redundancy', function () {
658 await enableRedundancyOnServer1() 658 await enableRedundancyOnServer1()
659 659
660 await waitJobs(servers) 660 await waitJobs(servers)
661 await waitUntilLog(servers[0], 'Duplicated ', 5) 661 await servers[0].serversCommand.waitUntilLog('Duplicated ', 5)
662 await waitJobs(servers) 662 await waitJobs(servers)
663 663
664 await check2Webseeds(video1Server2UUID) 664 await check2Webseeds(video1Server2UUID)
@@ -715,7 +715,7 @@ describe('Test videos redundancy', function () {
715 715
716 await waitJobs(servers) 716 await waitJobs(servers)
717 717
718 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].internalServerNumber, [ join('redundancy', 'hls') ]) 718 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0], [ join('redundancy', 'hls') ])
719 }) 719 })
720 720
721 after(async function () { 721 after(async function () {