diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-07 10:56:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | dab047092b51b453f175069573d8865fb17acdfc (patch) | |
tree | b53fbd6f6dfb5d5ce0e09da4ce694737dab3f07e /server/tests/api/redundancy/redundancy-constraints.ts | |
parent | ae2abfd3aed3e75d39a316b49b914d187faa7475 (diff) | |
download | PeerTube-dab047092b51b453f175069573d8865fb17acdfc.tar.gz PeerTube-dab047092b51b453f175069573d8865fb17acdfc.tar.zst PeerTube-dab047092b51b453f175069573d8865fb17acdfc.zip |
Introduce redundancy command
Diffstat (limited to 'server/tests/api/redundancy/redundancy-constraints.ts')
-rw-r--r-- | server/tests/api/redundancy/redundancy-constraints.ts | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts index 602f4bc1b..a666976b3 100644 --- a/server/tests/api/redundancy/redundancy-constraints.ts +++ b/server/tests/api/redundancy/redundancy-constraints.ts | |||
@@ -1,9 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { listVideoRedundancies, updateRedundancy } from '@shared/extra-utils/server/redundancy' | ||
6 | import { VideoPrivacy } from '@shared/models' | ||
7 | import { | 4 | import { |
8 | cleanupTests, | 5 | cleanupTests, |
9 | flushAndRunServer, | 6 | flushAndRunServer, |
@@ -13,9 +10,10 @@ import { | |||
13 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
14 | updateVideo, | 11 | updateVideo, |
15 | uploadVideo, | 12 | uploadVideo, |
13 | waitJobs, | ||
16 | waitUntilLog | 14 | waitUntilLog |
17 | } from '../../../../shared/extra-utils' | 15 | } from '@shared/extra-utils' |
18 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 16 | import { VideoPrivacy } from '@shared/models' |
19 | 17 | ||
20 | const expect = chai.expect | 18 | const expect = chai.expect |
21 | 19 | ||
@@ -50,23 +48,15 @@ describe('Test redundancy constraints', function () { | |||
50 | } | 48 | } |
51 | 49 | ||
52 | async function getTotalRedundanciesLocalServer () { | 50 | async function getTotalRedundanciesLocalServer () { |
53 | const res = await listVideoRedundancies({ | 51 | const body = await localServer.redundancyCommand.listVideos({ target: 'my-videos' }) |
54 | url: localServer.url, | ||
55 | accessToken: localServer.accessToken, | ||
56 | target: 'my-videos' | ||
57 | }) | ||
58 | 52 | ||
59 | return res.body.total | 53 | return body.total |
60 | } | 54 | } |
61 | 55 | ||
62 | async function getTotalRedundanciesRemoteServer () { | 56 | async function getTotalRedundanciesRemoteServer () { |
63 | const res = await listVideoRedundancies({ | 57 | const body = await remoteServer.redundancyCommand.listVideos({ target: 'remote-videos' }) |
64 | url: remoteServer.url, | ||
65 | accessToken: remoteServer.accessToken, | ||
66 | target: 'remote-videos' | ||
67 | }) | ||
68 | 58 | ||
69 | return res.body.total | 59 | return body.total |
70 | } | 60 | } |
71 | 61 | ||
72 | before(async function () { | 62 | before(async function () { |
@@ -99,7 +89,7 @@ describe('Test redundancy constraints', function () { | |||
99 | // Server 1 and server 2 follow each other | 89 | // Server 1 and server 2 follow each other |
100 | await remoteServer.followsCommand.follow({ targets: [ localServer.url ] }) | 90 | await remoteServer.followsCommand.follow({ targets: [ localServer.url ] }) |
101 | await waitJobs(servers) | 91 | await waitJobs(servers) |
102 | await updateRedundancy(remoteServer.url, remoteServer.accessToken, localServer.host, true) | 92 | await remoteServer.redundancyCommand.updateRedundancy({ host: localServer.host, redundancyAllowed: true }) |
103 | 93 | ||
104 | await waitJobs(servers) | 94 | await waitJobs(servers) |
105 | }) | 95 | }) |
@@ -161,7 +151,7 @@ describe('Test redundancy constraints', function () { | |||
161 | } | 151 | } |
162 | } | 152 | } |
163 | } | 153 | } |
164 | await killallServers([ localServer ]) | 154 | killallServers([ localServer ]) |
165 | await reRunServer(localServer, config) | 155 | await reRunServer(localServer, config) |
166 | 156 | ||
167 | await uploadWrapper('video 3 server 2') | 157 | await uploadWrapper('video 3 server 2') |