diff options
Diffstat (limited to 'server/tests/peertube-runner/client-cli.ts')
-rw-r--r-- | server/tests/peertube-runner/client-cli.ts | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/server/tests/peertube-runner/client-cli.ts b/server/tests/peertube-runner/client-cli.ts new file mode 100644 index 000000000..90bf73ef7 --- /dev/null +++ b/server/tests/peertube-runner/client-cli.ts | |||
@@ -0,0 +1,71 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { expect } from 'chai' | ||
4 | import { PeerTubeRunnerProcess } from '@server/tests/shared' | ||
5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' | ||
6 | |||
7 | describe('Test peertube-runner program client CLI', function () { | ||
8 | let server: PeerTubeServer | ||
9 | let peertubeRunner: PeerTubeRunnerProcess | ||
10 | |||
11 | before(async function () { | ||
12 | this.timeout(120_000) | ||
13 | |||
14 | server = await createSingleServer(1) | ||
15 | |||
16 | await setAccessTokensToServers([ server ]) | ||
17 | await setDefaultVideoChannel([ server ]) | ||
18 | |||
19 | await server.config.enableRemoteTranscoding() | ||
20 | |||
21 | peertubeRunner = new PeerTubeRunnerProcess() | ||
22 | await peertubeRunner.runServer() | ||
23 | }) | ||
24 | |||
25 | it('Should not have PeerTube instance listed', async function () { | ||
26 | const data = await peertubeRunner.listRegisteredPeerTubeInstances() | ||
27 | |||
28 | expect(data).to.not.contain(server.url) | ||
29 | }) | ||
30 | |||
31 | it('Should register a new PeerTube instance', async function () { | ||
32 | const registrationToken = await server.runnerRegistrationTokens.getFirstRegistrationToken() | ||
33 | |||
34 | await peertubeRunner.registerPeerTubeInstance({ | ||
35 | server, | ||
36 | registrationToken, | ||
37 | runnerName: 'my super runner', | ||
38 | runnerDescription: 'super description' | ||
39 | }) | ||
40 | }) | ||
41 | |||
42 | it('Should list this new PeerTube instance', async function () { | ||
43 | const data = await peertubeRunner.listRegisteredPeerTubeInstances() | ||
44 | |||
45 | expect(data).to.contain(server.url) | ||
46 | expect(data).to.contain('my super runner') | ||
47 | expect(data).to.contain('super description') | ||
48 | }) | ||
49 | |||
50 | it('Should still have the configuration after a restart', async function () { | ||
51 | peertubeRunner.kill() | ||
52 | |||
53 | await peertubeRunner.runServer() | ||
54 | }) | ||
55 | |||
56 | it('Should unregister the PeerTube instance', async function () { | ||
57 | await peertubeRunner.unregisterPeerTubeInstance({ server }) | ||
58 | }) | ||
59 | |||
60 | it('Should not have PeerTube instance listed', async function () { | ||
61 | const data = await peertubeRunner.listRegisteredPeerTubeInstances() | ||
62 | |||
63 | expect(data).to.not.contain(server.url) | ||
64 | }) | ||
65 | |||
66 | after(async function () { | ||
67 | await cleanupTests([ server ]) | ||
68 | |||
69 | peertubeRunner.kill() | ||
70 | }) | ||
71 | }) | ||