aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-28 11:07:23 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-28 11:35:26 +0100
commit26fcf2efebc681104d8e181da42b9ec112a8d28e (patch)
tree1d2a4a5c8c5547659274a765238b6b58839493eb /server/tests
parentb764380ac23f4e9d4677d08acdc3474c2931a16d (diff)
downloadPeerTube-26fcf2efebc681104d8e181da42b9ec112a8d28e.tar.gz
PeerTube-26fcf2efebc681104d8e181da42b9ec112a8d28e.tar.zst
PeerTube-26fcf2efebc681104d8e181da42b9ec112a8d28e.zip
Add redundancy CLI
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/cli/peertube.ts75
1 files changed, 72 insertions, 3 deletions
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index b8c0b1f79..09cbcdb65 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -6,15 +6,15 @@ import {
6 addVideoChannel, 6 addVideoChannel,
7 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
8 cleanupTests, 8 cleanupTests,
9 createUser, 9 createUser, doubleFollow,
10 execCLI, 10 execCLI,
11 flushAndRunServer, 11 flushAndRunServer,
12 getEnvCli, 12 getEnvCli, getLocalIdByUUID,
13 getVideo, 13 getVideo,
14 getVideosList, 14 getVideosList,
15 getVideosListWithToken, removeVideo, 15 getVideosListWithToken, removeVideo,
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers, uploadVideo, uploadVideoAndGetId,
18 userLogin, 18 userLogin,
19 waitJobs 19 waitJobs
20} from '../../../shared/extra-utils' 20} from '../../../shared/extra-utils'
@@ -210,6 +210,75 @@ describe('Test CLI wrapper', function () {
210 }) 210 })
211 }) 211 })
212 212
213 describe('Manage video redundancies', function () {
214 let anotherServer: ServerInfo
215 let video1Server2: number
216 let servers: ServerInfo[]
217
218 before(async function () {
219 this.timeout(120000)
220
221 anotherServer = await flushAndRunServer(2)
222 await setAccessTokensToServers([ anotherServer ])
223
224 await doubleFollow(server, anotherServer)
225
226 servers = [ server, anotherServer ]
227 await waitJobs(servers)
228
229 const uuid = (await uploadVideoAndGetId({ server: anotherServer, videoName: 'super video' })).uuid
230 await waitJobs(servers)
231
232 video1Server2 = await getLocalIdByUUID(server.url, uuid)
233 })
234
235 it('Should add a redundancy', async function () {
236 this.timeout(60000)
237
238 const env = getEnvCli(server)
239
240 const params = `add --video ${video1Server2}`
241
242 await execCLI(`${env} ${cmd} redundancy ${params}`)
243
244 await waitJobs(servers)
245 })
246
247 it('Should list redundancies', async function () {
248 this.timeout(60000)
249
250 {
251 const env = getEnvCli(server)
252
253 const params = `list-my-redundancies`
254 const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)
255
256 expect(stdout).to.contain('super video')
257 expect(stdout).to.contain(`localhost:${server.port}`)
258 }
259 })
260
261 it('Should remove a redundancy', async function () {
262 this.timeout(60000)
263
264 const env = getEnvCli(server)
265
266 const params = `remove --video ${video1Server2}`
267
268 await execCLI(`${env} ${cmd} redundancy ${params}`)
269
270 await waitJobs(servers)
271
272 {
273 const env = getEnvCli(server)
274 const params = `list-my-redundancies`
275 const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)
276
277 expect(stdout).to.not.contain('super video')
278 }
279 })
280 })
281
213 after(async function () { 282 after(async function () {
214 this.timeout(10000) 283 this.timeout(10000)
215 284