aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/servers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r--shared/extra-utils/server/servers.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 4c7d6862a..9167ebe5b 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -3,7 +3,7 @@
3import { ChildProcess, exec, fork } from 'child_process' 3import { ChildProcess, exec, fork } from 'child_process'
4import { join } from 'path' 4import { join } from 'path'
5import { root, wait } from '../miscs/miscs' 5import { root, wait } from '../miscs/miscs'
6import { copy, readdir, readFile, remove } from 'fs-extra' 6import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
7import { existsSync } from 'fs' 7import { existsSync } from 'fs'
8import { expect } from 'chai' 8import { expect } from 'chai'
9import { VideoChannel } from '../../models/videos' 9import { VideoChannel } from '../../models/videos'
@@ -241,20 +241,22 @@ async function reRunServer (server: ServerInfo, configOverride?: any) {
241 return server 241 return server
242} 242}
243 243
244async function checkTmpIsEmpty (server: ServerInfo) { 244function checkTmpIsEmpty (server: ServerInfo) {
245 return checkDirectoryIsEmpty(server, 'tmp') 245 return checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css' ])
246} 246}
247 247
248async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { 248async function checkDirectoryIsEmpty (server: ServerInfo, directory: string, exceptions: string[] = []) {
249 const testDirectory = 'test' + server.internalServerNumber 249 const testDirectory = 'test' + server.internalServerNumber
250 250
251 const directoryPath = join(root(), testDirectory, directory) 251 const directoryPath = join(root(), testDirectory, directory)
252 252
253 const directoryExists = existsSync(directoryPath) 253 const directoryExists = await pathExists(directoryPath)
254 expect(directoryExists).to.be.true 254 expect(directoryExists).to.be.true
255 255
256 const files = await readdir(directoryPath) 256 const files = await readdir(directoryPath)
257 expect(files).to.have.lengthOf(0) 257 const filtered = files.filter(f => exceptions.includes(f) === false)
258
259 expect(filtered).to.have.lengthOf(0)
258} 260}
259 261
260function killallServers (servers: ServerInfo[]) { 262function killallServers (servers: ServerInfo[]) {