diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/utils/server/servers.ts | 19 | ||||
-rw-r--r-- | shared/utils/videos/videos.ts | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/shared/utils/server/servers.ts b/shared/utils/server/servers.ts index 88d2b390c..568385a41 100644 --- a/shared/utils/server/servers.ts +++ b/shared/utils/server/servers.ts | |||
@@ -1,7 +1,11 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
1 | import { ChildProcess, exec, fork } from 'child_process' | 3 | import { ChildProcess, exec, fork } from 'child_process' |
2 | import { join } from 'path' | 4 | import { join } from 'path' |
3 | import { root, wait } from '../miscs/miscs' | 5 | import { root, wait } from '../miscs/miscs' |
4 | import { readFile } from 'fs-extra' | 6 | import { readdir, readFile } from 'fs-extra' |
7 | import { existsSync } from 'fs' | ||
8 | import { expect } from 'chai' | ||
5 | 9 | ||
6 | interface ServerInfo { | 10 | interface ServerInfo { |
7 | app: ChildProcess, | 11 | app: ChildProcess, |
@@ -153,6 +157,18 @@ async function reRunServer (server: ServerInfo, configOverride?: any) { | |||
153 | return server | 157 | return server |
154 | } | 158 | } |
155 | 159 | ||
160 | async function checkTmpIsEmpty (server: ServerInfo) { | ||
161 | const testDirectory = 'test' + server.serverNumber | ||
162 | |||
163 | const directoryPath = join(root(), testDirectory, 'tmp') | ||
164 | |||
165 | const directoryExists = existsSync(directoryPath) | ||
166 | expect(directoryExists).to.be.true | ||
167 | |||
168 | const files = await readdir(directoryPath) | ||
169 | expect(files).to.have.lengthOf(0) | ||
170 | } | ||
171 | |||
156 | function killallServers (servers: ServerInfo[]) { | 172 | function killallServers (servers: ServerInfo[]) { |
157 | for (const server of servers) { | 173 | for (const server of servers) { |
158 | process.kill(-server.app.pid) | 174 | process.kill(-server.app.pid) |
@@ -175,6 +191,7 @@ async function waitUntilLog (server: ServerInfo, str: string, count = 1) { | |||
175 | // --------------------------------------------------------------------------- | 191 | // --------------------------------------------------------------------------- |
176 | 192 | ||
177 | export { | 193 | export { |
194 | checkTmpIsEmpty, | ||
178 | ServerInfo, | 195 | ServerInfo, |
179 | flushAndRunMultipleServers, | 196 | flushAndRunMultipleServers, |
180 | flushTests, | 197 | flushTests, |
diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts index f5fcc6a8a..0cf6e7c4f 100644 --- a/shared/utils/videos/videos.ts +++ b/shared/utils/videos/videos.ts | |||
@@ -271,7 +271,7 @@ function removeVideo (url: string, token: string, id: number | string, expectedS | |||
271 | async function checkVideoFilesWereRemoved ( | 271 | async function checkVideoFilesWereRemoved ( |
272 | videoUUID: string, | 272 | videoUUID: string, |
273 | serverNumber: number, | 273 | serverNumber: number, |
274 | directories = [ 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ] | 274 | directories = [ 'redundancy', 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ] |
275 | ) { | 275 | ) { |
276 | const testDirectory = 'test' + serverNumber | 276 | const testDirectory = 'test' + serverNumber |
277 | 277 | ||