aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/redundancy/redundancy-constraints.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/redundancy/redundancy-constraints.ts')
-rw-r--r--server/tests/api/redundancy/redundancy-constraints.ts28
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
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { listVideoRedundancies, updateRedundancy } from '@shared/extra-utils/server/redundancy'
6import { VideoPrivacy } from '@shared/models'
7import { 4import {
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'
18import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 16import { VideoPrivacy } from '@shared/models'
19 17
20const expect = chai.expect 18const 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')