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