aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/video-abuses.ts2
-rw-r--r--server/tests/api/friends-advanced.ts12
-rw-r--r--server/tests/real-world/real-world.ts14
-rw-r--r--server/tests/real-world/tools/upload-directory.ts3
-rw-r--r--server/tests/utils/servers.ts2
5 files changed, 17 insertions, 16 deletions
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index 30d15778d..eac12b6f0 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -106,7 +106,7 @@ describe('Test video abuses API validators', function () {
106 it('Should fail with a wrong video', async function () { 106 it('Should fail with a wrong video', async function () {
107 const wrongPath = '/api/v1/videos/blabla/abuse' 107 const wrongPath = '/api/v1/videos/blabla/abuse'
108 const fields = {} 108 const fields = {}
109 await makePostBodyRequest({ url: server.url, path: wrongPath, token: server.accessToken, fields}) 109 await makePostBodyRequest({ url: server.url, path: wrongPath, token: server.accessToken, fields })
110 }) 110 })
111 111
112 it('Should fail with a non authenticated user', async function () { 112 it('Should fail with a non authenticated user', async function () {
diff --git a/server/tests/api/friends-advanced.ts b/server/tests/api/friends-advanced.ts
index 139019398..654c959fd 100644
--- a/server/tests/api/friends-advanced.ts
+++ b/server/tests/api/friends-advanced.ts
@@ -25,12 +25,12 @@ describe('Test advanced friends', function () {
25 25
26 async function makeFriendsWrapper (podNumber: number) { 26 async function makeFriendsWrapper (podNumber: number) {
27 const server = servers[podNumber - 1] 27 const server = servers[podNumber - 1]
28 return await makeFriends(server.url, server.accessToken) 28 return makeFriends(server.url, server.accessToken)
29 } 29 }
30 30
31 async function quitFriendsWrapper (podNumber: number) { 31 async function quitFriendsWrapper (podNumber: number) {
32 const server = servers[podNumber - 1] 32 const server = servers[podNumber - 1]
33 return await quitFriends(server.url, server.accessToken) 33 return quitFriends(server.url, server.accessToken)
34 } 34 }
35 35
36 async function removeFriendWrapper (podNumber: number, podNumberToRemove: number) { 36 async function removeFriendWrapper (podNumber: number, podNumberToRemove: number) {
@@ -42,12 +42,12 @@ describe('Test advanced friends', function () {
42 let friendsList = res.body.data 42 let friendsList = res.body.data
43 let podToRemove = friendsList.find(friend => (friend.host === serverToRemove.host)) 43 let podToRemove = friendsList.find(friend => (friend.host === serverToRemove.host))
44 44
45 return await quitOneFriend(server.url, server.accessToken, podToRemove.id) 45 return quitOneFriend(server.url, server.accessToken, podToRemove.id)
46 } 46 }
47 47
48 async function getFriendsListWrapper (podNumber: number) { 48 async function getFriendsListWrapper (podNumber: number) {
49 const server = servers[podNumber - 1] 49 const server = servers[podNumber - 1]
50 return await getFriendsList(server.url) 50 return getFriendsList(server.url)
51 } 51 }
52 52
53 async function uploadVideoWrapper (podNumber: number) { 53 async function uploadVideoWrapper (podNumber: number) {
@@ -56,11 +56,11 @@ describe('Test advanced friends', function () {
56 } 56 }
57 const server = servers[podNumber - 1] 57 const server = servers[podNumber - 1]
58 58
59 return await uploadVideo(server.url, server.accessToken, videoAttributes) 59 return uploadVideo(server.url, server.accessToken, videoAttributes)
60 } 60 }
61 61
62 async function getVideosWrapper (podNumber: number) { 62 async function getVideosWrapper (podNumber: number) {
63 return await getVideosList(servers[podNumber - 1].url) 63 return getVideosList(servers[podNumber - 1].url)
64 } 64 }
65 65
66 // --------------------------------------------------------------- 66 // ---------------------------------------------------------------
diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.ts
index e225a1266..da5696f8c 100644
--- a/server/tests/real-world/real-world.ts
+++ b/server/tests/real-world/real-world.ts
@@ -80,11 +80,15 @@ start()
80async function start () { 80async function start () {
81 const servers = await runServers(numberOfPods) 81 const servers = await runServers(numberOfPods)
82 82
83 process.on('exit', async () => await exitServers(servers, flushAtExit)) 83 process.on('exit', async () => {
84 await exitServers(servers, flushAtExit)
85
86 return
87 })
84 process.on('SIGINT', goodbye) 88 process.on('SIGINT', goodbye)
85 process.on('SIGTERM', goodbye) 89 process.on('SIGTERM', goodbye)
86 90
87 console.log('Servers runned') 91 console.log('Servers ran')
88 initializeRequestsPerServer(servers) 92 initializeRequestsPerServer(servers)
89 93
90 let checking = false 94 let checking = false
@@ -150,10 +154,8 @@ function getRandomNumServer (servers) {
150} 154}
151 155
152async function runServers (numberOfPods: number) { 156async function runServers (numberOfPods: number) {
153 let servers = null 157 const servers: ServerInfo[] = (await flushAndRunMultipleServers(numberOfPods))
154 158 .map(s => Object.assign({ requestsNumber: 0 }, s))
155 // Run servers
156 servers = await flushAndRunMultipleServers(numberOfPods)
157 159
158 // Get the access tokens 160 // Get the access tokens
159 await setAccessTokensToServers(servers) 161 await setAccessTokensToServers(servers)
diff --git a/server/tests/real-world/tools/upload-directory.ts b/server/tests/real-world/tools/upload-directory.ts
index a8ab1669d..fdd56857a 100644
--- a/server/tests/real-world/tools/upload-directory.ts
+++ b/server/tests/real-world/tools/upload-directory.ts
@@ -1,7 +1,6 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { isAbsolute } from 'path' 3import { isAbsolute, join } from 'path'
4import { join } from 'path'
5 4
6import { readdirPromise } from '../../../helpers/core-utils' 5import { readdirPromise } from '../../../helpers/core-utils'
7import { execCLI } from '../../utils' 6import { execCLI } from '../../utils'
diff --git a/server/tests/utils/servers.ts b/server/tests/utils/servers.ts
index 3526ffa51..f042a9e53 100644
--- a/server/tests/utils/servers.ts
+++ b/server/tests/utils/servers.ts
@@ -33,7 +33,7 @@ interface ServerInfo {
33 } 33 }
34} 34}
35 35
36async function flushAndRunMultipleServers (totalServers) { 36function flushAndRunMultipleServers (totalServers) {
37 let apps = [] 37 let apps = []
38 let i = 0 38 let i = 0
39 39