From 26fcf2efebc681104d8e181da42b9ec112a8d28e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Jan 2020 11:07:23 +0100 Subject: Add redundancy CLI --- server/tests/cli/peertube.ts | 75 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) (limited to 'server/tests') 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 { addVideoChannel, buildAbsoluteFixturePath, cleanupTests, - createUser, + createUser, doubleFollow, execCLI, flushAndRunServer, - getEnvCli, + getEnvCli, getLocalIdByUUID, getVideo, getVideosList, getVideosListWithToken, removeVideo, ServerInfo, - setAccessTokensToServers, + setAccessTokensToServers, uploadVideo, uploadVideoAndGetId, userLogin, waitJobs } from '../../../shared/extra-utils' @@ -210,6 +210,75 @@ describe('Test CLI wrapper', function () { }) }) + describe('Manage video redundancies', function () { + let anotherServer: ServerInfo + let video1Server2: number + let servers: ServerInfo[] + + before(async function () { + this.timeout(120000) + + anotherServer = await flushAndRunServer(2) + await setAccessTokensToServers([ anotherServer ]) + + await doubleFollow(server, anotherServer) + + servers = [ server, anotherServer ] + await waitJobs(servers) + + const uuid = (await uploadVideoAndGetId({ server: anotherServer, videoName: 'super video' })).uuid + await waitJobs(servers) + + video1Server2 = await getLocalIdByUUID(server.url, uuid) + }) + + it('Should add a redundancy', async function () { + this.timeout(60000) + + const env = getEnvCli(server) + + const params = `add --video ${video1Server2}` + + await execCLI(`${env} ${cmd} redundancy ${params}`) + + await waitJobs(servers) + }) + + it('Should list redundancies', async function () { + this.timeout(60000) + + { + const env = getEnvCli(server) + + const params = `list-my-redundancies` + const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) + + expect(stdout).to.contain('super video') + expect(stdout).to.contain(`localhost:${server.port}`) + } + }) + + it('Should remove a redundancy', async function () { + this.timeout(60000) + + const env = getEnvCli(server) + + const params = `remove --video ${video1Server2}` + + await execCLI(`${env} ${cmd} redundancy ${params}`) + + await waitJobs(servers) + + { + const env = getEnvCli(server) + const params = `list-my-redundancies` + const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`) + + expect(stdout).to.not.contain('super video') + } + }) + }) + after(async function () { this.timeout(10000) -- cgit v1.2.3