diff options
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index a0720d778..a0f0ce9c9 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -1,16 +1,15 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */ |
2 | 2 | ||
3 | import { ChildProcess, exec, fork } from 'child_process' | 3 | import { ChildProcess, exec, fork } from 'child_process' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root, wait } from '../miscs/miscs' | 5 | import { root, wait } from '../miscs/miscs' |
6 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' | 6 | import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' |
7 | import { existsSync } from 'fs' | ||
8 | import { expect } from 'chai' | 7 | import { expect } from 'chai' |
9 | import { VideoChannel } from '../../models/videos' | 8 | import { VideoChannel } from '../../models/videos' |
10 | import { randomInt } from '../../core-utils/miscs/miscs' | 9 | import { randomInt } from '../../core-utils/miscs/miscs' |
11 | 10 | ||
12 | interface ServerInfo { | 11 | interface ServerInfo { |
13 | app: ChildProcess, | 12 | app: ChildProcess |
14 | url: string | 13 | url: string |
15 | host: string | 14 | host: string |
16 | 15 | ||
@@ -20,13 +19,13 @@ interface ServerInfo { | |||
20 | serverNumber: number | 19 | serverNumber: number |
21 | 20 | ||
22 | client: { | 21 | client: { |
23 | id: string, | 22 | id: string |
24 | secret: string | 23 | secret: string |
25 | } | 24 | } |
26 | 25 | ||
27 | user: { | 26 | user: { |
28 | username: string, | 27 | username: string |
29 | password: string, | 28 | password: string |
30 | email?: string | 29 | email?: string |
31 | } | 30 | } |
32 | 31 | ||
@@ -57,7 +56,7 @@ function parallelTests () { | |||
57 | } | 56 | } |
58 | 57 | ||
59 | function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) { | 58 | function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) { |
60 | let apps = [] | 59 | const apps = [] |
61 | let i = 0 | 60 | let i = 0 |
62 | 61 | ||
63 | return new Promise<ServerInfo[]>(res => { | 62 | return new Promise<ServerInfo[]>(res => { |
@@ -203,20 +202,20 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = [] | |||
203 | 202 | ||
204 | // Capture things if we want to | 203 | // Capture things if we want to |
205 | for (const key of Object.keys(regexps)) { | 204 | for (const key of Object.keys(regexps)) { |
206 | const regexp = regexps[ key ] | 205 | const regexp = regexps[key] |
207 | const matches = data.toString().match(regexp) | 206 | const matches = data.toString().match(regexp) |
208 | if (matches !== null) { | 207 | if (matches !== null) { |
209 | if (key === 'client_id') server.client.id = matches[ 1 ] | 208 | if (key === 'client_id') server.client.id = matches[1] |
210 | else if (key === 'client_secret') server.client.secret = matches[ 1 ] | 209 | else if (key === 'client_secret') server.client.secret = matches[1] |
211 | else if (key === 'user_username') server.user.username = matches[ 1 ] | 210 | else if (key === 'user_username') server.user.username = matches[1] |
212 | else if (key === 'user_password') server.user.password = matches[ 1 ] | 211 | else if (key === 'user_password') server.user.password = matches[1] |
213 | } | 212 | } |
214 | } | 213 | } |
215 | 214 | ||
216 | // Check if all required sentences are here | 215 | // Check if all required sentences are here |
217 | for (const key of Object.keys(serverRunString)) { | 216 | for (const key of Object.keys(serverRunString)) { |
218 | if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true | 217 | if (data.toString().indexOf(key) !== -1) serverRunString[key] = true |
219 | if (serverRunString[ key ] === false) dontContinue = true | 218 | if (serverRunString[key] === false) dontContinue = true |
220 | } | 219 | } |
221 | 220 | ||
222 | // If no, there is maybe one thing not already initialized (client/user credentials generation...) | 221 | // If no, there is maybe one thing not already initialized (client/user credentials generation...) |