Cleanup tmp directory at startup

This commit is contained in:
Chocobozzz 2019-03-19 10:53:53 +01:00
parent dae86118ed
commit f4800714f9
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 11 additions and 2 deletions

View File

@ -24,7 +24,7 @@ async function installApplication () {
}),
// Directories
removeCacheDirectories()
removeCacheAndTmpDirectories()
.then(() => createDirectoriesIfNotExist())
])
} catch (err) {
@ -41,7 +41,7 @@ export {
// ---------------------------------------------------------------------------
function removeCacheDirectories () {
function removeCacheAndTmpDirectories () {
const cacheDirectories = Object.keys(CACHE)
.map(k => CACHE[k].DIRECTORY)
@ -53,6 +53,8 @@ function removeCacheDirectories () {
tasks.push(remove(dir))
}
tasks.push(remove(CONFIG.STORAGE.TMP_DIR))
return Promise.all(tasks)
}

View File

@ -4,6 +4,7 @@ import * as chai from 'chai'
import 'mocha'
import { Account } from '../../../../shared/models/actors'
import {
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
createUser,
doubleFollow,
@ -216,6 +217,12 @@ describe('Test users with multiple servers', function () {
}
})
it('Should have an empty tmp directory', async function () {
for (const server of servers) {
await checkTmpIsEmpty(server)
}
})
after(async function () {
killallServers(servers)
})