diff options
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 24 |
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 | ||
3 | import { expect } from 'chai' | ||
3 | import { ChildProcess, exec, fork } from 'child_process' | 4 | import { ChildProcess, exec, fork } from 'child_process' |
4 | import { join } from 'path' | ||
5 | import { root, wait } from '../miscs/miscs' | ||
6 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' | 5 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' |
7 | import { expect } from 'chai' | 6 | import { join } from 'path' |
8 | import { VideoChannel } from '../../models/videos' | ||
9 | import { randomInt } from '../../core-utils/miscs/miscs' | 7 | import { randomInt } from '../../core-utils/miscs/miscs' |
8 | import { VideoChannel } from '../../models/videos' | ||
9 | import { root, wait } from '../miscs/miscs' | ||
10 | 10 | ||
11 | interface ServerInfo { | 11 | interface 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 | ||
100 | function randomRTMP () { | ||
101 | const low = 1900 | ||
102 | const high = 2100 | ||
103 | |||
104 | return randomInt(low, high) | ||
105 | } | ||
106 | |||
98 | async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) { | 107 | async 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 | } |