Fix runner cleanup test

pull/5817/head
Chocobozzz 2023-05-19 14:35:03 +02:00
parent 476ce1d7f4
commit cfa6176381
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 12 additions and 7 deletions

View File

@ -178,7 +178,7 @@ describe('Test Live transcoding in peertube-runner program', function () {
describe('Check cleanup', function () {
it('Should have an empty cache directory', async function () {
await checkPeerTubeRunnerCacheIsEmpty()
await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
})
})

View File

@ -103,7 +103,7 @@ describe('Test studio transcoding in peertube-runner program', function () {
describe('Check cleanup', function () {
it('Should have an empty cache directory', async function () {
await checkPeerTubeRunnerCacheIsEmpty()
await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
})
})

View File

@ -189,7 +189,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
})
it('Should transcode videos on manual run', async function () {
this.timeout(240000)
this.timeout(360000)
await servers[0].config.disableTranscoding()
@ -329,7 +329,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Check cleanup', function () {
it('Should have an empty cache directory', async function () {
await checkPeerTubeRunnerCacheIsEmpty()
await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner)
})
})

View File

@ -5,6 +5,7 @@ import { pathExists, readdir } from 'fs-extra'
import { homedir } from 'os'
import { join } from 'path'
import { PeerTubeServer } from '@shared/server-commands'
import { PeerTubeRunnerProcess } from './peertube-runner-process'
export async function checkTmpIsEmpty (server: PeerTubeServer) {
await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
@ -30,8 +31,8 @@ export async function checkDirectoryIsEmpty (server: PeerTubeServer, directory:
expect(filtered).to.have.lengthOf(0)
}
export async function checkPeerTubeRunnerCacheIsEmpty () {
const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', 'test', 'transcoding')
export async function checkPeerTubeRunnerCacheIsEmpty (runner: PeerTubeRunnerProcess) {
const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', runner.getId(), 'transcoding')
const directoryExists = await pathExists(directoryPath)
expect(directoryExists).to.be.true

View File

@ -80,11 +80,15 @@ export class PeerTubeRunnerProcess {
this.app = null
}
getId () {
return 'test-' + this.server.internalServerNumber
}
private getRunnerPath () {
return join(root(), 'packages', 'peertube-runner', 'dist', 'peertube-runner.js')
}
private buildIdArg () {
return [ '--id', 'test-' + this.server.internalServerNumber ]
return [ '--id', this.getId() ]
}
}