diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-19 14:35:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-19 14:35:03 +0200 |
commit | cfa61763812954f738f2863948f6707f9fd3aad1 (patch) | |
tree | defaeb03e3a092ef3d3eb17150fa58831090ef66 | |
parent | 476ce1d7f42701cb2ce456b52c27a23ccfcef6d4 (diff) | |
download | PeerTube-cfa61763812954f738f2863948f6707f9fd3aad1.tar.gz PeerTube-cfa61763812954f738f2863948f6707f9fd3aad1.tar.zst PeerTube-cfa61763812954f738f2863948f6707f9fd3aad1.zip |
Fix runner cleanup test
-rw-r--r-- | server/tests/peertube-runner/live-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/peertube-runner/studio-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/peertube-runner/vod-transcoding.ts | 4 | ||||
-rw-r--r-- | server/tests/shared/directories.ts | 5 | ||||
-rw-r--r-- | server/tests/shared/peertube-runner-process.ts | 6 |
5 files changed, 12 insertions, 7 deletions
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 () { | |||
178 | describe('Check cleanup', function () { | 178 | describe('Check cleanup', function () { |
179 | 179 | ||
180 | it('Should have an empty cache directory', async function () { | 180 | it('Should have an empty cache directory', async function () { |
181 | await checkPeerTubeRunnerCacheIsEmpty() | 181 | await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner) |
182 | }) | 182 | }) |
183 | }) | 183 | }) |
184 | 184 | ||
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 () { | |||
103 | describe('Check cleanup', function () { | 103 | describe('Check cleanup', function () { |
104 | 104 | ||
105 | it('Should have an empty cache directory', async function () { | 105 | it('Should have an empty cache directory', async function () { |
106 | await checkPeerTubeRunnerCacheIsEmpty() | 106 | await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner) |
107 | }) | 107 | }) |
108 | }) | 108 | }) |
109 | 109 | ||
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 () { | |||
189 | }) | 189 | }) |
190 | 190 | ||
191 | it('Should transcode videos on manual run', async function () { | 191 | it('Should transcode videos on manual run', async function () { |
192 | this.timeout(240000) | 192 | this.timeout(360000) |
193 | 193 | ||
194 | await servers[0].config.disableTranscoding() | 194 | await servers[0].config.disableTranscoding() |
195 | 195 | ||
@@ -329,7 +329,7 @@ describe('Test VOD transcoding in peertube-runner program', function () { | |||
329 | describe('Check cleanup', function () { | 329 | describe('Check cleanup', function () { |
330 | 330 | ||
331 | it('Should have an empty cache directory', async function () { | 331 | it('Should have an empty cache directory', async function () { |
332 | await checkPeerTubeRunnerCacheIsEmpty() | 332 | await checkPeerTubeRunnerCacheIsEmpty(peertubeRunner) |
333 | }) | 333 | }) |
334 | }) | 334 | }) |
335 | 335 | ||
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' | |||
5 | import { homedir } from 'os' | 5 | import { homedir } from 'os' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { PeerTubeServer } from '@shared/server-commands' | 7 | import { PeerTubeServer } from '@shared/server-commands' |
8 | import { PeerTubeRunnerProcess } from './peertube-runner-process' | ||
8 | 9 | ||
9 | export async function checkTmpIsEmpty (server: PeerTubeServer) { | 10 | export async function checkTmpIsEmpty (server: PeerTubeServer) { |
10 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) | 11 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) |
@@ -30,8 +31,8 @@ export async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: | |||
30 | expect(filtered).to.have.lengthOf(0) | 31 | expect(filtered).to.have.lengthOf(0) |
31 | } | 32 | } |
32 | 33 | ||
33 | export async function checkPeerTubeRunnerCacheIsEmpty () { | 34 | export async function checkPeerTubeRunnerCacheIsEmpty (runner: PeerTubeRunnerProcess) { |
34 | const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', 'test', 'transcoding') | 35 | const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', runner.getId(), 'transcoding') |
35 | 36 | ||
36 | const directoryExists = await pathExists(directoryPath) | 37 | const directoryExists = await pathExists(directoryPath) |
37 | expect(directoryExists).to.be.true | 38 | 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 { | |||
80 | this.app = null | 80 | this.app = null |
81 | } | 81 | } |
82 | 82 | ||
83 | getId () { | ||
84 | return 'test-' + this.server.internalServerNumber | ||
85 | } | ||
86 | |||
83 | private getRunnerPath () { | 87 | private getRunnerPath () { |
84 | return join(root(), 'packages', 'peertube-runner', 'dist', 'peertube-runner.js') | 88 | return join(root(), 'packages', 'peertube-runner', 'dist', 'peertube-runner.js') |
85 | } | 89 | } |
86 | 90 | ||
87 | private buildIdArg () { | 91 | private buildIdArg () { |
88 | return [ '--id', 'test-' + this.server.internalServerNumber ] | 92 | return [ '--id', this.getId() ] |
89 | } | 93 | } |
90 | } | 94 | } |