]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/servers.js
Fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / utils / servers.js
index 01c9a2f3919be10aca01595228072ad28c8a4f70..afb08e6fc86fe56b013e78fbda982f20e703e535 100644 (file)
@@ -34,7 +34,7 @@ function flushAndRunMultipleServers (totalServers, serversRun) {
         runServer(j, function (app, url) {
           anotherServerDone(j, app, url)
         })
-      }, 1000 * j)
+      }, 1000 * (j - 1))
     }
   })
 }
@@ -60,12 +60,13 @@ function runServer (number, callback) {
 
   // These actions are async so we need to be sure that they have both been done
   const serverRunString = {
-    'Connected to mongodb': false,
     'Server listening on port': false
   }
+  const key = 'Database peertube_test' + number + ' is ready'
+  serverRunString[key] = false
 
   const regexps = {
-    client_id: 'Client id: ([a-f0-9]+)',
+    client_id: 'Client id: (.+)',
     client_secret: 'Client secret: (.+)',
     user_username: 'Username: (.+)',
     user_password: 'User password: (.+)'
@@ -81,7 +82,7 @@ function runServer (number, callback) {
     detached: true
   }
 
-  server.app = fork(pathUtils.join(__dirname, '../../../server.js'), [], options)
+  server.app = fork(pathUtils.join(__dirname, '..', '..', '..', 'server.js'), [], options)
   server.app.stdout.on('data', function onStdout (data) {
     let dontContinue = false
 
@@ -103,7 +104,7 @@ function runServer (number, callback) {
       if (serverRunString[key] === false) dontContinue = true
     }
 
-    // If no, there is maybe one thing not already initialized (mongodb...)
+    // If no, there is maybe one thing not already initialized (client/user credentials generation...)
     if (dontContinue === true) return
 
     server.app.stdout.removeListener('data', onStdout)