Correctly cleanup server tests

This commit is contained in:
Chocobozzz 2022-02-28 15:51:41 +01:00
parent 5273f40afc
commit cba7977552
No known key found for this signature in database
GPG Key ID: 583A612D890159BE

View File

@ -30,10 +30,12 @@ export class ServersCommand extends AbstractCommand {
}) })
} }
async cleanupTests () { cleanupTests () {
const p: Promise<any>[] = [] const promises: Promise<any>[] = []
const saveGithubLogsIfNeeded = async () => {
if (!isGithubCI()) return
if (isGithubCI()) {
await ensureDir('artifacts') await ensureDir('artifacts')
const origin = this.buildDirectory('logs/peertube.log') const origin = this.buildDirectory('logs/peertube.log')
@ -44,14 +46,17 @@ export class ServersCommand extends AbstractCommand {
} }
if (this.server.parallel) { if (this.server.parallel) {
p.push(ServersCommand.flushTests(this.server.internalServerNumber)) const promise = saveGithubLogsIfNeeded()
.then(() => ServersCommand.flushTests(this.server.internalServerNumber))
promises.push(promise)
} }
if (this.server.customConfigFile) { if (this.server.customConfigFile) {
p.push(remove(this.server.customConfigFile)) promises.push(remove(this.server.customConfigFile))
} }
return p return promises
} }
async waitUntilLog (str: string, count = 1, strictCount = true) { async waitUntilLog (str: string, count = 1, strictCount = true) {