aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/utils')
-rw-r--r--shared/utils/server/servers.ts19
-rw-r--r--shared/utils/videos/videos.ts2
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
1import { ChildProcess, exec, fork } from 'child_process' 3import { ChildProcess, exec, fork } from 'child_process'
2import { join } from 'path' 4import { join } from 'path'
3import { root, wait } from '../miscs/miscs' 5import { root, wait } from '../miscs/miscs'
4import { readFile } from 'fs-extra' 6import { readdir, readFile } from 'fs-extra'
7import { existsSync } from 'fs'
8import { expect } from 'chai'
5 9
6interface ServerInfo { 10interface 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
160async 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
156function killallServers (servers: ServerInfo[]) { 172function 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
177export { 193export {
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
271async function checkVideoFilesWereRemoved ( 271async 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