From cba7977552e909ea0ea4dc526788a9166ad5f535 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 28 Feb 2022 15:51:41 +0100 Subject: Correctly cleanup server tests --- shared/server-commands/server/servers-command.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'shared/server-commands/server/servers-command.ts') diff --git a/shared/server-commands/server/servers-command.ts b/shared/server-commands/server/servers-command.ts index c5d8d18dc..19645cb93 100644 --- a/shared/server-commands/server/servers-command.ts +++ b/shared/server-commands/server/servers-command.ts @@ -30,10 +30,12 @@ export class ServersCommand extends AbstractCommand { }) } - async cleanupTests () { - const p: Promise[] = [] + cleanupTests () { + const promises: Promise[] = [] + + const saveGithubLogsIfNeeded = async () => { + if (!isGithubCI()) return - if (isGithubCI()) { await ensureDir('artifacts') const origin = this.buildDirectory('logs/peertube.log') @@ -44,14 +46,17 @@ export class ServersCommand extends AbstractCommand { } 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) { - p.push(remove(this.server.customConfigFile)) + promises.push(remove(this.server.customConfigFile)) } - return p + return promises } async waitUntilLog (str: string, count = 1, strictCount = true) { -- cgit v1.2.3