diff options
Diffstat (limited to 'server/tests/api/multiplePods.js')
-rw-r--r-- | server/tests/api/multiplePods.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js index 2a1bc64e6..ac140f6bb 100644 --- a/server/tests/api/multiplePods.js +++ b/server/tests/api/multiplePods.js | |||
@@ -1,9 +1,10 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const async = require('async') | ||
4 | const chai = require('chai') | 3 | const chai = require('chai') |
4 | const each = require('async/each') | ||
5 | const expect = chai.expect | 5 | const expect = chai.expect |
6 | const pathUtils = require('path') | 6 | const pathUtils = require('path') |
7 | const series = require('async/series') | ||
7 | 8 | ||
8 | const utils = require('./utils') | 9 | const utils = require('./utils') |
9 | const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) | 10 | const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) |
@@ -16,7 +17,7 @@ describe('Test multiple pods', function () { | |||
16 | before(function (done) { | 17 | before(function (done) { |
17 | this.timeout(30000) | 18 | this.timeout(30000) |
18 | 19 | ||
19 | async.series([ | 20 | series([ |
20 | // Run servers | 21 | // Run servers |
21 | function (next) { | 22 | function (next) { |
22 | utils.flushAndRunMultipleServers(3, function (serversRun) { | 23 | utils.flushAndRunMultipleServers(3, function (serversRun) { |
@@ -26,7 +27,7 @@ describe('Test multiple pods', function () { | |||
26 | }, | 27 | }, |
27 | // Get the access tokens | 28 | // Get the access tokens |
28 | function (next) { | 29 | function (next) { |
29 | async.each(servers, function (server, callbackEach) { | 30 | each(servers, function (server, callbackEach) { |
30 | utils.loginAndGetAccessToken(server, function (err, accessToken) { | 31 | utils.loginAndGetAccessToken(server, function (err, accessToken) { |
31 | if (err) return callbackEach(err) | 32 | if (err) return callbackEach(err) |
32 | 33 | ||
@@ -56,7 +57,7 @@ describe('Test multiple pods', function () { | |||
56 | }) | 57 | }) |
57 | 58 | ||
58 | it('Should not have videos for all pods', function (done) { | 59 | it('Should not have videos for all pods', function (done) { |
59 | async.each(servers, function (server, callback) { | 60 | each(servers, function (server, callback) { |
60 | utils.getVideosList(server.url, function (err, res) { | 61 | utils.getVideosList(server.url, function (err, res) { |
61 | if (err) throw err | 62 | if (err) throw err |
62 | 63 | ||
@@ -73,7 +74,7 @@ describe('Test multiple pods', function () { | |||
73 | it('Should upload the video on pod 1 and propagate on each pod', function (done) { | 74 | it('Should upload the video on pod 1 and propagate on each pod', function (done) { |
74 | this.timeout(15000) | 75 | this.timeout(15000) |
75 | 76 | ||
76 | async.series([ | 77 | series([ |
77 | function (next) { | 78 | function (next) { |
78 | const name = 'my super name for pod 1' | 79 | const name = 'my super name for pod 1' |
79 | const description = 'my super description for pod 1' | 80 | const description = 'my super description for pod 1' |
@@ -88,7 +89,7 @@ describe('Test multiple pods', function () { | |||
88 | function (err) { | 89 | function (err) { |
89 | if (err) throw err | 90 | if (err) throw err |
90 | 91 | ||
91 | async.each(servers, function (server, callback) { | 92 | each(servers, function (server, callback) { |
92 | let baseMagnet = null | 93 | let baseMagnet = null |
93 | 94 | ||
94 | utils.getVideosList(server.url, function (err, res) { | 95 | utils.getVideosList(server.url, function (err, res) { |
@@ -135,7 +136,7 @@ describe('Test multiple pods', function () { | |||
135 | it('Should upload the video on pod 2 and propagate on each pod', function (done) { | 136 | it('Should upload the video on pod 2 and propagate on each pod', function (done) { |
136 | this.timeout(15000) | 137 | this.timeout(15000) |
137 | 138 | ||
138 | async.series([ | 139 | series([ |
139 | function (next) { | 140 | function (next) { |
140 | const name = 'my super name for pod 2' | 141 | const name = 'my super name for pod 2' |
141 | const description = 'my super description for pod 2' | 142 | const description = 'my super description for pod 2' |
@@ -150,7 +151,7 @@ describe('Test multiple pods', function () { | |||
150 | function (err) { | 151 | function (err) { |
151 | if (err) throw err | 152 | if (err) throw err |
152 | 153 | ||
153 | async.each(servers, function (server, callback) { | 154 | each(servers, function (server, callback) { |
154 | let baseMagnet = null | 155 | let baseMagnet = null |
155 | 156 | ||
156 | utils.getVideosList(server.url, function (err, res) { | 157 | utils.getVideosList(server.url, function (err, res) { |
@@ -197,7 +198,7 @@ describe('Test multiple pods', function () { | |||
197 | it('Should upload two videos on pod 3 and propagate on each pod', function (done) { | 198 | it('Should upload two videos on pod 3 and propagate on each pod', function (done) { |
198 | this.timeout(30000) | 199 | this.timeout(30000) |
199 | 200 | ||
200 | async.series([ | 201 | series([ |
201 | function (next) { | 202 | function (next) { |
202 | const name = 'my super name for pod 3' | 203 | const name = 'my super name for pod 3' |
203 | const description = 'my super description for pod 3' | 204 | const description = 'my super description for pod 3' |
@@ -220,7 +221,7 @@ describe('Test multiple pods', function () { | |||
220 | 221 | ||
221 | let baseMagnet = null | 222 | let baseMagnet = null |
222 | // All pods should have this video | 223 | // All pods should have this video |
223 | async.each(servers, function (server, callback) { | 224 | each(servers, function (server, callback) { |
224 | utils.getVideosList(server.url, function (err, res) { | 225 | utils.getVideosList(server.url, function (err, res) { |
225 | if (err) throw err | 226 | if (err) throw err |
226 | 227 | ||
@@ -372,7 +373,7 @@ describe('Test multiple pods', function () { | |||
372 | it('Should remove the file 3 and 3-2 by asking pod 3', function (done) { | 373 | it('Should remove the file 3 and 3-2 by asking pod 3', function (done) { |
373 | this.timeout(15000) | 374 | this.timeout(15000) |
374 | 375 | ||
375 | async.series([ | 376 | series([ |
376 | function (next) { | 377 | function (next) { |
377 | utils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[0], next) | 378 | utils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[0], next) |
378 | }, | 379 | }, |
@@ -387,7 +388,7 @@ describe('Test multiple pods', function () { | |||
387 | }) | 388 | }) |
388 | 389 | ||
389 | it('Should have videos 1 and 3 on each pod', function (done) { | 390 | it('Should have videos 1 and 3 on each pod', function (done) { |
390 | async.each(servers, function (server, callback) { | 391 | each(servers, function (server, callback) { |
391 | utils.getVideosList(server.url, function (err, res) { | 392 | utils.getVideosList(server.url, function (err, res) { |
392 | if (err) throw err | 393 | if (err) throw err |
393 | 394 | ||