aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/directories.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/directories.ts')
-rw-r--r--server/tests/shared/directories.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/server/tests/shared/directories.ts b/server/tests/shared/directories.ts
index a614cef7c..4f4282554 100644
--- a/server/tests/shared/directories.ts
+++ b/server/tests/shared/directories.ts
@@ -2,9 +2,11 @@
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { pathExists, readdir } from 'fs-extra' 4import { pathExists, readdir } from 'fs-extra'
5import { homedir } from 'os'
6import { join } from 'path'
5import { PeerTubeServer } from '@shared/server-commands' 7import { PeerTubeServer } from '@shared/server-commands'
6 8
7async function checkTmpIsEmpty (server: PeerTubeServer) { 9export async function checkTmpIsEmpty (server: PeerTubeServer) {
8 await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) 10 await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
9 11
10 if (await pathExists(server.getDirectoryPath('tmp/hls'))) { 12 if (await pathExists(server.getDirectoryPath('tmp/hls'))) {
@@ -12,11 +14,11 @@ async function checkTmpIsEmpty (server: PeerTubeServer) {
12 } 14 }
13} 15}
14 16
15async function checkPersistentTmpIsEmpty (server: PeerTubeServer) { 17export async function checkPersistentTmpIsEmpty (server: PeerTubeServer) {
16 await checkDirectoryIsEmpty(server, 'tmp-persistent') 18 await checkDirectoryIsEmpty(server, 'tmp-persistent')
17} 19}
18 20
19async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { 21export async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) {
20 const directoryPath = server.getDirectoryPath(directory) 22 const directoryPath = server.getDirectoryPath(directory)
21 23
22 const directoryExists = await pathExists(directoryPath) 24 const directoryExists = await pathExists(directoryPath)
@@ -28,8 +30,13 @@ async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string,
28 expect(filtered).to.have.lengthOf(0) 30 expect(filtered).to.have.lengthOf(0)
29} 31}
30 32
31export { 33export async function checkPeerTubeRunnerCacheIsEmpty () {
32 checkTmpIsEmpty, 34 const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', 'test', 'transcoding')
33 checkPersistentTmpIsEmpty, 35
34 checkDirectoryIsEmpty 36 const directoryExists = await pathExists(directoryPath)
37 expect(directoryExists).to.be.true
38
39 const files = await readdir(directoryPath)
40
41 expect(files).to.have.lengthOf(0)
35} 42}