aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/servers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-12-10 11:24:17 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-14 09:11:27 +0100
commit83ef31fe10061f0d3db0df1bc5e7f208972982eb (patch)
tree5d6878c5803e1181ad1a7749c62da56e6f8607e5 /shared/extra-utils/server/servers.ts
parent040d6896a3cd5622e78cccdedd8cce2afcf49a31 (diff)
downloadPeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.tar.gz
PeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.tar.zst
PeerTube-83ef31fe10061f0d3db0df1bc5e7f208972982eb.zip
Save logs on ci failure
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r--shared/extra-utils/server/servers.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index e88482e49..fe4ed3e48 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -2,11 +2,11 @@
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { ChildProcess, exec, fork } from 'child_process' 4import { ChildProcess, exec, fork } from 'child_process'
5import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' 5import { copy, ensureDir, pathExists, readdir, readFile, remove } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { randomInt } from '../../core-utils/miscs/miscs' 7import { randomInt } from '../../core-utils/miscs/miscs'
8import { VideoChannel } from '../../models/videos' 8import { VideoChannel } from '../../models/videos'
9import { buildServerDirectory, getFileSize, root, wait } from '../miscs/miscs' 9import { buildServerDirectory, getFileSize, isGithubCI, root, wait } from '../miscs/miscs'
10 10
11interface ServerInfo { 11interface ServerInfo {
12 app: ChildProcess 12 app: ChildProcess
@@ -298,11 +298,23 @@ function killallServers (servers: ServerInfo[]) {
298 } 298 }
299} 299}
300 300
301function cleanupTests (servers: ServerInfo[]) { 301async function cleanupTests (servers: ServerInfo[]) {
302 killallServers(servers) 302 killallServers(servers)
303 303
304 if (isGithubCI()) {
305 await ensureDir('artifacts')
306 }
307
304 const p: Promise<any>[] = [] 308 const p: Promise<any>[] = []
305 for (const server of servers) { 309 for (const server of servers) {
310 if (isGithubCI()) {
311 const origin = await buildServerDirectory(server, 'logs/peertube.log')
312 const destname = `peertube-${server.internalServerNumber}.log`
313 console.log('Saving logs %s.', destname)
314
315 await copy(origin, join('artifacts', destname))
316 }
317
306 if (server.parallel) { 318 if (server.parallel) {
307 p.push(flushTests(server.internalServerNumber)) 319 p.push(flushTests(server.internalServerNumber))
308 } 320 }