import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
import {
addVideoChannel,
+ checkTmpIsEmpty,
checkVideoFilesWereRemoved,
completeVideoCheck,
createUser,
})
})
+ describe('TMP directory', function () {
+ it('Should have an empty tmp directory', async function () {
+ for (const server of servers) {
+ await checkTmpIsEmpty(server)
+ }
+ })
+ })
+
after(async function () {
killallServers(servers)
+/* tslint:disable:no-unused-expression */
+
import { ChildProcess, exec, fork } from 'child_process'
import { join } from 'path'
import { root, wait } from '../miscs/miscs'
-import { readFile } from 'fs-extra'
+import { readdir, readFile } from 'fs-extra'
+import { existsSync } from 'fs'
+import { expect } from 'chai'
interface ServerInfo {
app: ChildProcess,
return server
}
+async function checkTmpIsEmpty (server: ServerInfo) {
+ const testDirectory = 'test' + server.serverNumber
+
+ const directoryPath = join(root(), testDirectory, 'tmp')
+
+ const directoryExists = existsSync(directoryPath)
+ expect(directoryExists).to.be.true
+
+ const files = await readdir(directoryPath)
+ expect(files).to.have.lengthOf(0)
+}
+
function killallServers (servers: ServerInfo[]) {
for (const server of servers) {
process.kill(-server.app.pid)
// ---------------------------------------------------------------------------
export {
+ checkTmpIsEmpty,
ServerInfo,
flushAndRunMultipleServers,
flushTests,
async function checkVideoFilesWereRemoved (
videoUUID: string,
serverNumber: number,
- directories = [ 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ]
+ directories = [ 'redundancy', 'videos', 'thumbnails', 'torrents', 'previews', 'captions' ]
) {
const testDirectory = 'test' + serverNumber