diff options
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 14 |
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 @@ | |||
3 | import { ChildProcess, exec, fork } from 'child_process' | 3 | import { ChildProcess, exec, fork } from 'child_process' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root, wait } from '../miscs/miscs' | 5 | import { root, wait } from '../miscs/miscs' |
6 | import { copy, readdir, readFile, remove } from 'fs-extra' | 6 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' |
7 | import { existsSync } from 'fs' | 7 | import { existsSync } from 'fs' |
8 | import { expect } from 'chai' | 8 | import { expect } from 'chai' |
9 | import { VideoChannel } from '../../models/videos' | 9 | import { 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 | ||
244 | async function checkTmpIsEmpty (server: ServerInfo) { | 244 | function checkTmpIsEmpty (server: ServerInfo) { |
245 | return checkDirectoryIsEmpty(server, 'tmp') | 245 | return checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css' ]) |
246 | } | 246 | } |
247 | 247 | ||
248 | async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { | 248 | async 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 | ||
260 | function killallServers (servers: ServerInfo[]) { | 262 | function killallServers (servers: ServerInfo[]) { |