aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-06 16:43:43 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7 (patch)
tree7ccb6a7c97345747dde6c53fcd10c488140c7998 /shared/extra-utils/server
parente4bf78561763cd84d22ebceb6f371cccf9a356d8 (diff)
downloadPeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.tar.gz
PeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.tar.zst
PeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.zip
Update ffmpeg static version for tests
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r--shared/extra-utils/server/servers.ts24
1 files changed, 20 insertions, 4 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index b4bd55968..e26a6937c 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -1,12 +1,12 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
2 2
3import { expect } from 'chai'
3import { ChildProcess, exec, fork } from 'child_process' 4import { ChildProcess, exec, fork } from 'child_process'
4import { join } from 'path'
5import { root, wait } from '../miscs/miscs'
6import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' 5import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
7import { expect } from 'chai' 6import { join } from 'path'
8import { VideoChannel } from '../../models/videos'
9import { randomInt } from '../../core-utils/miscs/miscs' 7import { randomInt } from '../../core-utils/miscs/miscs'
8import { VideoChannel } from '../../models/videos'
9import { root, wait } from '../miscs/miscs'
10 10
11interface ServerInfo { 11interface ServerInfo {
12 app: ChildProcess 12 app: ChildProcess
@@ -16,6 +16,8 @@ interface ServerInfo {
16 hostname: string 16 hostname: string
17 port: number 17 port: number
18 18
19 rtmpPort: number
20
19 parallel: boolean 21 parallel: boolean
20 internalServerNumber: number 22 internalServerNumber: number
21 serverNumber: number 23 serverNumber: number
@@ -95,10 +97,18 @@ function randomServer () {
95 return randomInt(low, high) 97 return randomInt(low, high)
96} 98}
97 99
100function randomRTMP () {
101 const low = 1900
102 const high = 2100
103
104 return randomInt(low, high)
105}
106
98async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) { 107async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {
99 const parallel = parallelTests() 108 const parallel = parallelTests()
100 109
101 const internalServerNumber = parallel ? randomServer() : serverNumber 110 const internalServerNumber = parallel ? randomServer() : serverNumber
111 const rtmpPort = parallel ? randomRTMP() : null
102 const port = 9000 + internalServerNumber 112 const port = 9000 + internalServerNumber
103 113
104 await flushTests(internalServerNumber) 114 await flushTests(internalServerNumber)
@@ -107,6 +117,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
107 app: null, 117 app: null,
108 port, 118 port,
109 internalServerNumber, 119 internalServerNumber,
120 rtmpPort,
110 parallel, 121 parallel,
111 serverNumber, 122 serverNumber,
112 url: `http://localhost:${port}`, 123 url: `http://localhost:${port}`,
@@ -178,6 +189,11 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
178 }, 189 },
179 admin: { 190 admin: {
180 email: `admin${server.internalServerNumber}@example.com` 191 email: `admin${server.internalServerNumber}@example.com`
192 },
193 live: {
194 rtmp: {
195 port: server.rtmpPort
196 }
181 } 197 }
182 }) 198 })
183 } 199 }