aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
commit1a42c9e2c0fb64cdbebd81b311736e752f591e0a (patch)
treee893324d730878257491428ffca634a92f1eea05 /server/tests
parentd56ec0d4129160a6e3b51ace3766bb325db1f101 (diff)
downloadPeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.gz
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.zst
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.zip
Server: udpate async to 2.0.0
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/checkParams.js4
-rw-r--r--server/tests/api/friendsAdvanced.js17
-rw-r--r--server/tests/api/friendsBasic.js17
-rw-r--r--server/tests/api/multiplePods.js25
-rw-r--r--server/tests/api/singlePod.js9
-rw-r--r--server/tests/api/users.js4
-rw-r--r--server/tests/real-world/real-world.js11
7 files changed, 46 insertions, 41 deletions
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js
index 7f22a37cc..c1ba9c2c0 100644
--- a/server/tests/api/checkParams.js
+++ b/server/tests/api/checkParams.js
@@ -1,10 +1,10 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
5const expect = chai.expect 4const expect = chai.expect
6const pathUtils = require('path') 5const pathUtils = require('path')
7const request = require('supertest') 6const request = require('supertest')
7const series = require('async/series')
8 8
9const utils = require('./utils') 9const utils = require('./utils')
10 10
@@ -57,7 +57,7 @@ describe('Test parameters validator', function () {
57 before(function (done) { 57 before(function (done) {
58 this.timeout(20000) 58 this.timeout(20000)
59 59
60 async.series([ 60 series([
61 function (next) { 61 function (next) {
62 utils.flushTests(next) 62 utils.flushTests(next)
63 }, 63 },
diff --git a/server/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js
index b082270ff..603fbc16b 100644
--- a/server/tests/api/friendsAdvanced.js
+++ b/server/tests/api/friendsAdvanced.js
@@ -1,8 +1,9 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
4const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const series = require('async/series')
6 7
7const utils = require('./utils') 8const utils = require('./utils')
8 9
@@ -45,7 +46,7 @@ describe('Test advanced friends', function () {
45 utils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { 46 utils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) {
46 servers = serversRun 47 servers = serversRun
47 48
48 async.each(servers, function (server, callbackEach) { 49 each(servers, function (server, callbackEach) {
49 utils.loginAndGetAccessToken(server, function (err, accessToken) { 50 utils.loginAndGetAccessToken(server, function (err, accessToken) {
50 if (err) return callbackEach(err) 51 if (err) return callbackEach(err)
51 52
@@ -59,7 +60,7 @@ describe('Test advanced friends', function () {
59 it('Should make friends with two pod each in a different group', function (done) { 60 it('Should make friends with two pod each in a different group', function (done) {
60 this.timeout(20000) 61 this.timeout(20000)
61 62
62 async.series([ 63 series([
63 // Pod 3 makes friend with the first one 64 // Pod 3 makes friend with the first one
64 function (next) { 65 function (next) {
65 makeFriends(3, next) 66 makeFriends(3, next)
@@ -93,7 +94,7 @@ describe('Test advanced friends', function () {
93 it('Should quit all friends', function (done) { 94 it('Should quit all friends', function (done) {
94 this.timeout(10000) 95 this.timeout(10000)
95 96
96 async.series([ 97 series([
97 function (next) { 98 function (next) {
98 quitFriends(1, next) 99 quitFriends(1, next)
99 }, 100 },
@@ -103,7 +104,7 @@ describe('Test advanced friends', function () {
103 function (err) { 104 function (err) {
104 if (err) throw err 105 if (err) throw err
105 106
106 async.each([ 1, 2, 3, 4, 5, 6 ], function (i, callback) { 107 each([ 1, 2, 3, 4, 5, 6 ], function (i, callback) {
107 getFriendsList(i, function (err, res) { 108 getFriendsList(i, function (err, res) {
108 if (err) throw err 109 if (err) throw err
109 110
@@ -119,7 +120,7 @@ describe('Test advanced friends', function () {
119 it('Should make friends with the pods 1, 2, 3', function (done) { 120 it('Should make friends with the pods 1, 2, 3', function (done) {
120 this.timeout(150000) 121 this.timeout(150000)
121 122
122 async.series([ 123 series([
123 // Pods 1, 2, 3 and 4 become friends 124 // Pods 1, 2, 3 and 4 become friends
124 function (next) { 125 function (next) {
125 makeFriends(2, next) 126 makeFriends(2, next)
@@ -132,7 +133,7 @@ describe('Test advanced friends', function () {
132 }, 133 },
133 // Check the pods 1, 2, 3 and 4 are friends 134 // Check the pods 1, 2, 3 and 4 are friends
134 function (next) { 135 function (next) {
135 async.each([ 1, 2, 3, 4 ], function (i, callback) { 136 each([ 1, 2, 3, 4 ], function (i, callback) {
136 getFriendsList(i, function (err, res) { 137 getFriendsList(i, function (err, res) {
137 if (err) throw err 138 if (err) throw err
138 139
@@ -211,7 +212,7 @@ describe('Test advanced friends', function () {
211 it('Should pod 1 quit friends', function (done) { 212 it('Should pod 1 quit friends', function (done) {
212 this.timeout(25000) 213 this.timeout(25000)
213 214
214 async.series([ 215 series([
215 // Upload a video on server 3 for aditionnal tests 216 // Upload a video on server 3 for aditionnal tests
216 function (next) { 217 function (next) {
217 uploadVideo(3, next) 218 uploadVideo(3, next)
diff --git a/server/tests/api/friendsBasic.js b/server/tests/api/friendsBasic.js
index 5b738ad39..c74a7f224 100644
--- a/server/tests/api/friendsBasic.js
+++ b/server/tests/api/friendsBasic.js
@@ -1,8 +1,9 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
4const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const series = require('async/series')
6 7
7const utils = require('./utils') 8const utils = require('./utils')
8 9
@@ -45,7 +46,7 @@ describe('Test basic friends', function () {
45 utils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { 46 utils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) {
46 servers = serversRun 47 servers = serversRun
47 48
48 async.each(servers, function (server, callbackEach) { 49 each(servers, function (server, callbackEach) {
49 utils.loginAndGetAccessToken(server, function (err, accessToken) { 50 utils.loginAndGetAccessToken(server, function (err, accessToken) {
50 if (err) return callbackEach(err) 51 if (err) return callbackEach(err)
51 52
@@ -57,7 +58,7 @@ describe('Test basic friends', function () {
57 }) 58 })
58 59
59 it('Should not have friends', function (done) { 60 it('Should not have friends', function (done) {
60 async.each(servers, function (server, callback) { 61 each(servers, function (server, callback) {
61 utils.getFriendsList(server.url, function (err, res) { 62 utils.getFriendsList(server.url, function (err, res) {
62 if (err) throw err 63 if (err) throw err
63 64
@@ -72,7 +73,7 @@ describe('Test basic friends', function () {
72 it('Should make friends', function (done) { 73 it('Should make friends', function (done) {
73 this.timeout(10000) 74 this.timeout(10000)
74 75
75 async.series([ 76 series([
76 // The second pod make friend with the third 77 // The second pod make friend with the third
77 function (next) { 78 function (next) {
78 makeFriends(2, next) 79 makeFriends(2, next)
@@ -119,7 +120,7 @@ describe('Test basic friends', function () {
119 // Now each pod should be friend with the other ones 120 // Now each pod should be friend with the other ones
120 function (err) { 121 function (err) {
121 if (err) throw err 122 if (err) throw err
122 async.each(servers, function (server, callback) { 123 each(servers, function (server, callback) {
123 testMadeFriends(servers, server, callback) 124 testMadeFriends(servers, server, callback)
124 }, done) 125 }, done)
125 }) 126 })
@@ -131,7 +132,7 @@ describe('Test basic friends', function () {
131 }) 132 })
132 133
133 it('Should quit friends of pod 2', function (done) { 134 it('Should quit friends of pod 2', function (done) {
134 async.series([ 135 series([
135 // Pod 1 quit friends 136 // Pod 1 quit friends
136 function (next) { 137 function (next) {
137 const server = servers[1] 138 const server = servers[1]
@@ -151,7 +152,7 @@ describe('Test basic friends', function () {
151 }, 152 },
152 // Other pods shouldn't have pod 1 too 153 // Other pods shouldn't have pod 1 too
153 function (next) { 154 function (next) {
154 async.each([ servers[0].url, servers[2].url ], function (url, callback) { 155 each([ servers[0].url, servers[2].url ], function (url, callback) {
155 utils.getFriendsList(url, function (err, res) { 156 utils.getFriendsList(url, function (err, res) {
156 if (err) throw err 157 if (err) throw err
157 158
@@ -169,7 +170,7 @@ describe('Test basic friends', function () {
169 it('Should allow pod 2 to make friend again', function (done) { 170 it('Should allow pod 2 to make friend again', function (done) {
170 const server = servers[1] 171 const server = servers[1]
171 utils.makeFriends(server.url, server.accessToken, function () { 172 utils.makeFriends(server.url, server.accessToken, function () {
172 async.each(servers, function (server, callback) { 173 each(servers, function (server, callback) {
173 testMadeFriends(servers, server, callback) 174 testMadeFriends(servers, server, callback)
174 }, done) 175 }, done)
175 }) 176 })
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
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
4const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const pathUtils = require('path') 6const pathUtils = require('path')
7const series = require('async/series')
7 8
8const utils = require('./utils') 9const utils = require('./utils')
9const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) 10const 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
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index 465a86b13..6ed719f87 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -1,11 +1,12 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
4const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const fs = require('fs') 6const fs = require('fs')
7const keyBy = require('lodash/keyBy') 7const keyBy = require('lodash/keyBy')
8const pathUtils = require('path') 8const pathUtils = require('path')
9const series = require('async/series')
9 10
10const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) 11const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
11webtorrent.silent = true 12webtorrent.silent = true
@@ -20,7 +21,7 @@ describe('Test a single pod', function () {
20 before(function (done) { 21 before(function (done) {
21 this.timeout(20000) 22 this.timeout(20000)
22 23
23 async.series([ 24 series([
24 function (next) { 25 function (next) {
25 utils.flushTests(next) 26 utils.flushTests(next)
26 }, 27 },
@@ -280,7 +281,7 @@ describe('Test a single pod', function () {
280 'video_short.mp4', 'video_short.ogv', 'video_short.webm', 281 'video_short.mp4', 'video_short.ogv', 'video_short.webm',
281 'video_short1.webm', 'video_short2.webm', 'video_short3.webm' 282 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
282 ] 283 ]
283 async.each(videos, function (video, callbackEach) { 284 each(videos, function (video, callbackEach) {
284 const name = video + ' name' 285 const name = video + ' name'
285 const description = video + ' description' 286 const description = video + ' description'
286 const tags = [ 'tag1', 'tag2', 'tag3' ] 287 const tags = [ 'tag1', 'tag2', 'tag3' ]
@@ -318,7 +319,7 @@ describe('Test a single pod', function () {
318 // For the next test 319 // For the next test
319 videosListBase = videos 320 videosListBase = videos
320 321
321 async.each(videos, function (video, callbackEach) { 322 each(videos, function (video, callbackEach) {
322 if (err) throw err 323 if (err) throw err
323 const videoName = video.name.replace(' name', '') 324 const videoName = video.name.replace(' name', '')
324 325
diff --git a/server/tests/api/users.js b/server/tests/api/users.js
index 7ab426d85..749aa8af8 100644
--- a/server/tests/api/users.js
+++ b/server/tests/api/users.js
@@ -1,9 +1,9 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const chai = require('chai') 3const chai = require('chai')
5const expect = chai.expect 4const expect = chai.expect
6const pathUtils = require('path') 5const pathUtils = require('path')
6const series = require('async/series')
7 7
8const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent')) 8const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
9webtorrent.silent = true 9webtorrent.silent = true
@@ -18,7 +18,7 @@ describe('Test users', function () {
18 before(function (done) { 18 before(function (done) {
19 this.timeout(20000) 19 this.timeout(20000)
20 20
21 async.series([ 21 series([
22 function (next) { 22 function (next) {
23 utils.flushTests(next) 23 utils.flushTests(next)
24 }, 24 },
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index bc6ea859b..b28796852 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -1,8 +1,9 @@
1'use strict' 1'use strict'
2 2
3const async = require('async') 3const each = require('each')
4const program = require('commander')
5const isEqual = require('lodash/isEqual') 4const isEqual = require('lodash/isEqual')
5const program = require('commander')
6const series = require('async/series')
6 7
7process.env.NODE_ENV = 'test' 8process.env.NODE_ENV = 'test'
8const constants = require('../../initializers/constants') 9const constants = require('../../initializers/constants')
@@ -93,7 +94,7 @@ function getRandomNumServer (servers) {
93function runServers (numberOfPods, callback) { 94function runServers (numberOfPods, callback) {
94 let servers = null 95 let servers = null
95 96
96 async.series([ 97 series([
97 // Run servers 98 // Run servers
98 function (next) { 99 function (next) {
99 utils.flushAndRunMultipleServers(numberOfPods, function (serversRun) { 100 utils.flushAndRunMultipleServers(numberOfPods, function (serversRun) {
@@ -103,7 +104,7 @@ function runServers (numberOfPods, callback) {
103 }, 104 },
104 // Get the access tokens 105 // Get the access tokens
105 function (next) { 106 function (next) {
106 async.each(servers, function (server, callbackEach) { 107 each(servers, function (server, callbackEach) {
107 utils.loginAndGetAccessToken(server, function (err, accessToken) { 108 utils.loginAndGetAccessToken(server, function (err, accessToken) {
108 if (err) return callbackEach(err) 109 if (err) return callbackEach(err)
109 110
@@ -184,7 +185,7 @@ function remove (servers, numServer, callback) {
184 185
185function checkIntegrity (servers, callback) { 186function checkIntegrity (servers, callback) {
186 const videos = [] 187 const videos = []
187 async.each(servers, function (server, callback) { 188 each(servers, function (server, callback) {
188 utils.getAllVideosListBy(server.url, function (err, res) { 189 utils.getAllVideosListBy(server.url, function (err, res) {
189 if (err) throw err 190 if (err) throw err
190 const serverVideos = res.body.data 191 const serverVideos = res.body.data