aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/tests/api/server/no-client.ts2
-rw-r--r--server/tools/test-live.ts2
-rw-r--r--shared/extra-utils/server/server.ts13
-rw-r--r--shared/extra-utils/server/servers.ts4
4 files changed, 11 insertions, 10 deletions
diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.ts
index efa890ad4..719813ae9 100644
--- a/server/tests/api/server/no-client.ts
+++ b/server/tests/api/server/no-client.ts
@@ -9,7 +9,7 @@ describe('Start and stop server without web client routes', function () {
9 before(async function () { 9 before(async function () {
10 this.timeout(30000) 10 this.timeout(30000)
11 11
12 server = await createSingleServer(1, {}, [ '--no-client' ]) 12 server = await createSingleServer(1, {}, { peertubeArgs: [ '--no-client' ] })
13 }) 13 })
14 14
15 it('Should fail getting the client', function () { 15 it('Should fail getting the client', function () {
diff --git a/server/tools/test-live.ts b/server/tools/test-live.ts
index 0cb0c3668..50dc04438 100644
--- a/server/tools/test-live.ts
+++ b/server/tools/test-live.ts
@@ -36,7 +36,7 @@ async function run () {
36 36
37 console.log('Starting server.') 37 console.log('Starting server.')
38 38
39 const server = await createSingleServer(1, {}, [], { hideLogs: false, execArgv: [ '--inspect' ] }) 39 const server = await createSingleServer(1, {}, { hideLogs: false, nodeArgs: [ '--inspect' ] })
40 40
41 const cleanup = async () => { 41 const cleanup = async () => {
42 console.log('Killing server') 42 console.log('Killing server')
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts
index b33bb9d1e..5bdcbac52 100644
--- a/shared/extra-utils/server/server.ts
+++ b/shared/extra-utils/server/server.ts
@@ -41,7 +41,8 @@ import { StatsCommand } from './stats-command'
41 41
42export type RunServerOptions = { 42export type RunServerOptions = {
43 hideLogs?: boolean 43 hideLogs?: boolean
44 execArgv?: string[] 44 nodeArgs?: string[]
45 peertubeArgs?: string[]
45} 46}
46 47
47export class PeerTubeServer { 48export class PeerTubeServer {
@@ -176,13 +177,13 @@ export class PeerTubeServer {
176 this.port = parseInt(parsed.port) 177 this.port = parseInt(parsed.port)
177 } 178 }
178 179
179 async flushAndRun (configOverride?: Object, args = [], options: RunServerOptions = {}) { 180 async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) {
180 await ServersCommand.flushTests(this.internalServerNumber) 181 await ServersCommand.flushTests(this.internalServerNumber)
181 182
182 return this.run(configOverride, args, options) 183 return this.run(configOverride, options)
183 } 184 }
184 185
185 async run (configOverrideArg?: any, args = [], options: RunServerOptions = {}) { 186 async run (configOverrideArg?: any, options: RunServerOptions = {}) {
186 // These actions are async so we need to be sure that they have both been done 187 // These actions are async so we need to be sure that they have both been done
187 const serverRunString = { 188 const serverRunString = {
188 'HTTP server listening': false 189 'HTTP server listening': false
@@ -215,13 +216,13 @@ export class PeerTubeServer {
215 silent: true, 216 silent: true,
216 env, 217 env,
217 detached: true, 218 detached: true,
218 execArgv: options.execArgv || [] 219 execArgv: options.nodeArgs || []
219 } 220 }
220 221
221 return new Promise<void>(res => { 222 return new Promise<void>(res => {
222 const self = this 223 const self = this
223 224
224 this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions) 225 this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
225 this.app.stdout.on('data', function onStdout (data) { 226 this.app.stdout.on('data', function onStdout (data) {
226 let dontContinue = false 227 let dontContinue = false
227 228
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 87d7e9449..f0622feb0 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -2,10 +2,10 @@ import { ensureDir } from 'fs-extra'
2import { isGithubCI } from '../miscs' 2import { isGithubCI } from '../miscs'
3import { PeerTubeServer, RunServerOptions } from './server' 3import { PeerTubeServer, RunServerOptions } from './server'
4 4
5async function createSingleServer (serverNumber: number, configOverride?: Object, args = [], options: RunServerOptions = {}) { 5async function createSingleServer (serverNumber: number, configOverride?: Object, options: RunServerOptions = {}) {
6 const server = new PeerTubeServer({ serverNumber }) 6 const server = new PeerTubeServer({ serverNumber })
7 7
8 await server.flushAndRun(configOverride, args, options) 8 await server.flushAndRun(configOverride, options)
9 9
10 return server 10 return server
11} 11}