From cfa61763812954f738f2863948f6707f9fd3aad1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 May 2023 14:35:03 +0200 Subject: Fix runner cleanup test --- server/tests/peertube-runner/live-transcoding.ts | 2 +- server/tests/peertube-runner/studio-transcoding.ts | 2 +- server/tests/peertube-runner/vod-transcoding.ts | 4 ++-- server/tests/shared/directories.ts | 5 +++-- server/tests/shared/peertube-runner-process.ts | 6 +++++- 5 files changed, 12 insertions(+), 7 deletions(-) (limited to 'server') diff --git a/server/tests/peertube-runner/live-transcoding.ts b/server/tests/peertube-runner/live-transcoding.ts index c56f4cd84..17e1f3078 100644 --- a/server/tests/peertube-runner/live-transcoding.ts +++ b/server/tests/peertube-runner/live-transcoding.ts @@ -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) }) }) diff --git a/server/tests/peertube-runner/studio-transcoding.ts b/server/tests/peertube-runner/studio-transcoding.ts index f60b83dbd..400203eb3 100644 --- a/server/tests/peertube-runner/studio-transcoding.ts +++ b/server/tests/peertube-runner/studio-transcoding.ts @@ -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) }) }) diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts index 02d839339..f1670c1fb 100644 --- a/server/tests/peertube-runner/vod-transcoding.ts +++ b/server/tests/peertube-runner/vod-transcoding.ts @@ -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) }) }) diff --git a/server/tests/shared/directories.ts b/server/tests/shared/directories.ts index 4f4282554..22578bc0e 100644 --- a/server/tests/shared/directories.ts +++ b/server/tests/shared/directories.ts @@ -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 diff --git a/server/tests/shared/peertube-runner-process.ts b/server/tests/shared/peertube-runner-process.ts index 6ad2cd116..b3c8dfe0e 100644 --- a/server/tests/shared/peertube-runner-process.ts +++ b/server/tests/shared/peertube-runner-process.ts @@ -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() ] } } -- cgit v1.2.3