aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/peertube-runner/client-cli.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 15:00:01 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commitd102de1b38f2877463529c3b27bd35ffef4fd8bf (patch)
tree31fa0bdf26ad7a2ee46d600d804a6f03260266c8 /server/tests/peertube-runner/client-cli.ts
parent2fe978744e5b74eb824e4d79c1bb9b840169f125 (diff)
downloadPeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.gz
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.tar.zst
PeerTube-d102de1b38f2877463529c3b27bd35ffef4fd8bf.zip
Add runner server tests
Diffstat (limited to 'server/tests/peertube-runner/client-cli.ts')
-rw-r--r--server/tests/peertube-runner/client-cli.ts71
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
3import { expect } from 'chai'
4import { PeerTubeRunnerProcess } from '@server/tests/shared'
5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'
6
7describe('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})