]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Try to fix travis
authorChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 10:02:04 +0000 (12:02 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 24 Apr 2019 14:26:24 +0000 (16:26 +0200)
server/tests/api/check-params/users.ts
server/tests/api/check-params/video-comments.ts
server/tests/api/videos/videos-overview.ts
shared/extra-utils/server/servers.ts

index 00d0a7e2be7e7fafd1f843cb59238965809ada89..d2fea65f61d3d5dde755b5ac50b5350a0805b682 100644 (file)
@@ -6,9 +6,27 @@ import { join } from 'path'
 import { UserRole, VideoImport, VideoImportState } from '../../../../shared'
 
 import {
-  createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
-  makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, flushAndRunServer, ServerInfo, setAccessTokensToServers,
-  updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
+  blockUser,
+  createUser,
+  deleteMe,
+  flushAndRunServer,
+  getMyUserInformation,
+  getMyUserVideoRating,
+  getUsersList,
+  immutableAssign,
+  killallServers,
+  makeGetRequest,
+  makePostBodyRequest,
+  makePutBodyRequest,
+  makeUploadRequest,
+  registerUser,
+  removeUser,
+  ServerInfo,
+  setAccessTokensToServers,
+  unblockUser,
+  updateUser,
+  uploadVideo,
+  userLogin
 } from '../../../../shared/extra-utils'
 import {
   checkBadCountPagination,
index bb14abbfd2c77e6c2a19efd2ba3e30ee12297435..dfa4c29b64e85f29d3f85bc85c44e7aedf815df6 100644 (file)
@@ -4,8 +4,15 @@ import * as chai from 'chai'
 import 'mocha'
 import {
   createUser,
-  flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, flushAndRunServer, ServerInfo, setAccessTokensToServers,
-  uploadVideo, userLogin
+  flushAndRunServer,
+  killallServers,
+  makeDeleteRequest,
+  makeGetRequest,
+  makePostBodyRequest,
+  ServerInfo,
+  setAccessTokensToServers,
+  uploadVideo,
+  userLogin
 } from '../../../../shared/extra-utils'
 import {
   checkBadCountPagination,
index c921eb74dd89f508979237f609c5164fc404df48..c63725d71dbcdb8ffdd7cd1fecce43834dc6f251 100644 (file)
@@ -2,7 +2,7 @@
 
 import * as chai from 'chai'
 import 'mocha'
-import { flushTests, killallServers, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils'
+import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils'
 import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews'
 import { VideosOverview } from '../../../../shared/models/overviews'
 
index 480d1233083e20d714a83c499bf4bcd6b0132038..add738056af9a52ea1b3fad8924418553d66a422 100644 (file)
@@ -87,12 +87,14 @@ function randomServer () {
   return Math.floor(Math.random() * (high - low) + low)
 }
 
-function flushAndRunServer (serverNumber: number, configOverrideArg?: Object, args = []) {
+async function flushAndRunServer (serverNumber: number, configOverrideArg?: Object, args = []) {
   const parallel = process.env.MOCHA_PARALLEL === 'true'
 
   const internalServerNumber = parallel ? randomServer() : serverNumber
   const port = 9000 + internalServerNumber
 
+  await flushTests(serverNumber)
+
   const server: ServerInfo = {
     app: null,
     port,
@@ -175,45 +177,41 @@ function flushAndRunServer (serverNumber: number, configOverrideArg?: Object, ar
   }
 
   return new Promise<ServerInfo>(res => {
-    flushTests(internalServerNumber)
-      .then(() => {
-
-        server.app = fork(join(root(), 'dist', 'server.js'), args, options)
-        server.app.stdout.on('data', function onStdout (data) {
-          let dontContinue = false
-
-          // Capture things if we want to
-          for (const key of Object.keys(regexps)) {
-            const regexp = regexps[ key ]
-            const matches = data.toString().match(regexp)
-            if (matches !== null) {
-              if (key === 'client_id') server.client.id = matches[ 1 ]
-              else if (key === 'client_secret') server.client.secret = matches[ 1 ]
-              else if (key === 'user_username') server.user.username = matches[ 1 ]
-              else if (key === 'user_password') server.user.password = matches[ 1 ]
-            }
-          }
-
-          // Check if all required sentences are here
-          for (const key of Object.keys(serverRunString)) {
-            if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true
-            if (serverRunString[ key ] === false) dontContinue = true
-          }
-
-          // If no, there is maybe one thing not already initialized (client/user credentials generation...)
-          if (dontContinue === true) return
-
-          server.app.stdout.removeListener('data', onStdout)
-
-          process.on('exit', () => {
-            try {
-              process.kill(server.app.pid)
-            } catch { /* empty */ }
-          })
-
-          res(server)
-        })
+    server.app = fork(join(root(), 'dist', 'server.js'), args, options)
+    server.app.stdout.on('data', function onStdout (data) {
+      let dontContinue = false
+
+      // Capture things if we want to
+      for (const key of Object.keys(regexps)) {
+        const regexp = regexps[ key ]
+        const matches = data.toString().match(regexp)
+        if (matches !== null) {
+          if (key === 'client_id') server.client.id = matches[ 1 ]
+          else if (key === 'client_secret') server.client.secret = matches[ 1 ]
+          else if (key === 'user_username') server.user.username = matches[ 1 ]
+          else if (key === 'user_password') server.user.password = matches[ 1 ]
+        }
+      }
+
+      // Check if all required sentences are here
+      for (const key of Object.keys(serverRunString)) {
+        if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true
+        if (serverRunString[ key ] === false) dontContinue = true
+      }
+
+      // If no, there is maybe one thing not already initialized (client/user credentials generation...)
+      if (dontContinue === true) return
+
+      server.app.stdout.removeListener('data', onStdout)
+
+      process.on('exit', () => {
+        try {
+          process.kill(server.app.pid)
+        } catch { /* empty */ }
       })
+
+      res(server)
+    })
   })
 }