2023-04-21 08:00:01 -05:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
|
|
|
|
|
|
|
import { expect } from 'chai'
|
|
|
|
import { PeerTubeRunnerProcess } from '@server/tests/shared'
|
|
|
|
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'
|
|
|
|
|
|
|
|
describe('Test peertube-runner program client CLI', function () {
|
|
|
|
let server: PeerTubeServer
|
|
|
|
let peertubeRunner: PeerTubeRunnerProcess
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
this.timeout(120_000)
|
|
|
|
|
|
|
|
server = await createSingleServer(1)
|
|
|
|
|
|
|
|
await setAccessTokensToServers([ server ])
|
|
|
|
await setDefaultVideoChannel([ server ])
|
|
|
|
|
|
|
|
await server.config.enableRemoteTranscoding()
|
|
|
|
|
2023-05-19 06:33:27 -05:00
|
|
|
peertubeRunner = new PeerTubeRunnerProcess(server)
|
2023-04-21 08:00:01 -05:00
|
|
|
await peertubeRunner.runServer()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should not have PeerTube instance listed', async function () {
|
|
|
|
const data = await peertubeRunner.listRegisteredPeerTubeInstances()
|
|
|
|
|
|
|
|
expect(data).to.not.contain(server.url)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should register a new PeerTube instance', async function () {
|
|
|
|
const registrationToken = await server.runnerRegistrationTokens.getFirstRegistrationToken()
|
|
|
|
|
|
|
|
await peertubeRunner.registerPeerTubeInstance({
|
|
|
|
registrationToken,
|
|
|
|
runnerName: 'my super runner',
|
|
|
|
runnerDescription: 'super description'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should list this new PeerTube instance', async function () {
|
|
|
|
const data = await peertubeRunner.listRegisteredPeerTubeInstances()
|
|
|
|
|
|
|
|
expect(data).to.contain(server.url)
|
|
|
|
expect(data).to.contain('my super runner')
|
|
|
|
expect(data).to.contain('super description')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should still have the configuration after a restart', async function () {
|
|
|
|
peertubeRunner.kill()
|
|
|
|
|
|
|
|
await peertubeRunner.runServer()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should unregister the PeerTube instance', async function () {
|
2023-05-26 02:03:50 -05:00
|
|
|
await peertubeRunner.unregisterPeerTubeInstance({ runnerName: 'my super runner' })
|
2023-04-21 08:00:01 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should not have PeerTube instance listed', async function () {
|
|
|
|
const data = await peertubeRunner.listRegisteredPeerTubeInstances()
|
|
|
|
|
|
|
|
expect(data).to.not.contain(server.url)
|
|
|
|
})
|
|
|
|
|
|
|
|
after(async function () {
|
|
|
|
peertubeRunner.kill()
|
2023-05-05 07:35:59 -05:00
|
|
|
|
|
|
|
await cleanupTests([ server ])
|
2023-04-21 08:00:01 -05:00
|
|
|
})
|
|
|
|
})
|