diff options
author | Green-Star <Green-Star@users.noreply.github.com> | 2017-07-02 20:48:31 +0200 |
---|---|---|
committer | Bigard Florian <florian.bigard@gmail.com> | 2017-07-02 20:48:31 +0200 |
commit | 5fe7e898316e18369c3e1aba307b55077adc7bfb (patch) | |
tree | 1ea859558b44250dce43be1be7261c2e79df454b /server/tests/api | |
parent | ba44fa19531186944fef3e9da34f5e91f0c0dedb (diff) | |
download | PeerTube-5fe7e898316e18369c3e1aba307b55077adc7bfb.tar.gz PeerTube-5fe7e898316e18369c3e1aba307b55077adc7bfb.tar.zst PeerTube-5fe7e898316e18369c3e1aba307b55077adc7bfb.zip |
Fix test (#71)
* Fix timeouting tests
* Increase timeout to be sure requests will be propagated
* Add timeout to be sure video views will be updated
* Use standard style
* Fix PR comments.
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/users.js | 2 | ||||
-rw-r--r-- | server/tests/api/check-params/video-blacklists.js | 2 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.js | 3 | ||||
-rw-r--r-- | server/tests/api/config.js | 2 | ||||
-rw-r--r-- | server/tests/api/friends-advanced.js | 2 | ||||
-rw-r--r-- | server/tests/api/friends-basic.js | 9 | ||||
-rw-r--r-- | server/tests/api/multiple-pods.js | 6 | ||||
-rw-r--r-- | server/tests/api/request-schedulers.js | 2 | ||||
-rw-r--r-- | server/tests/api/single-pod.js | 5 | ||||
-rw-r--r-- | server/tests/api/users.js | 2 | ||||
-rw-r--r-- | server/tests/api/video-abuse.js | 2 | ||||
-rw-r--r-- | server/tests/api/video-blacklist.js | 2 |
12 files changed, 22 insertions, 17 deletions
diff --git a/server/tests/api/check-params/users.js b/server/tests/api/check-params/users.js index 0ba5e77c3..2c1189f7a 100644 --- a/server/tests/api/check-params/users.js +++ b/server/tests/api/check-params/users.js | |||
@@ -23,7 +23,7 @@ describe('Test users API validators', function () { | |||
23 | // --------------------------------------------------------------- | 23 | // --------------------------------------------------------------- |
24 | 24 | ||
25 | before(function (done) { | 25 | before(function (done) { |
26 | this.timeout(20000) | 26 | this.timeout(120000) |
27 | 27 | ||
28 | series([ | 28 | series([ |
29 | function (next) { | 29 | function (next) { |
diff --git a/server/tests/api/check-params/video-blacklists.js b/server/tests/api/check-params/video-blacklists.js index a39ab0cfa..53b503e56 100644 --- a/server/tests/api/check-params/video-blacklists.js +++ b/server/tests/api/check-params/video-blacklists.js | |||
@@ -17,7 +17,7 @@ describe('Test video blacklists API validators', function () { | |||
17 | // --------------------------------------------------------------- | 17 | // --------------------------------------------------------------- |
18 | 18 | ||
19 | before(function (done) { | 19 | before(function (done) { |
20 | this.timeout(20000) | 20 | this.timeout(120000) |
21 | 21 | ||
22 | series([ | 22 | series([ |
23 | function (next) { | 23 | function (next) { |
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js index ec4cc4ce8..ce6c49583 100644 --- a/server/tests/api/check-params/videos.js +++ b/server/tests/api/check-params/videos.js | |||
@@ -378,7 +378,7 @@ describe('Test videos API validator', function () { | |||
378 | }) | 378 | }) |
379 | 379 | ||
380 | it('Should succeed with the correct parameters', function (done) { | 380 | it('Should succeed with the correct parameters', function (done) { |
381 | this.timeout(5000) | 381 | this.timeout(10000) |
382 | 382 | ||
383 | const data = { | 383 | const data = { |
384 | name: 'my super name', | 384 | name: 'my super name', |
@@ -392,6 +392,7 @@ describe('Test videos API validator', function () { | |||
392 | const attach = { | 392 | const attach = { |
393 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | 393 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') |
394 | } | 394 | } |
395 | |||
395 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { | 396 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { |
396 | attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4') | 397 | attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4') |
397 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { | 398 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { |
diff --git a/server/tests/api/config.js b/server/tests/api/config.js index 08f955f2d..e79e12823 100644 --- a/server/tests/api/config.js +++ b/server/tests/api/config.js | |||
@@ -13,7 +13,7 @@ describe('Test config', function () { | |||
13 | let server = null | 13 | let server = null |
14 | 14 | ||
15 | before(function (done) { | 15 | before(function (done) { |
16 | this.timeout(20000) | 16 | this.timeout(120000) |
17 | 17 | ||
18 | series([ | 18 | series([ |
19 | function (next) { | 19 | function (next) { |
diff --git a/server/tests/api/friends-advanced.js b/server/tests/api/friends-advanced.js index d433e97d0..237cb533d 100644 --- a/server/tests/api/friends-advanced.js +++ b/server/tests/api/friends-advanced.js | |||
@@ -46,7 +46,7 @@ describe('Test advanced friends', function () { | |||
46 | // --------------------------------------------------------------- | 46 | // --------------------------------------------------------------- |
47 | 47 | ||
48 | before(function (done) { | 48 | before(function (done) { |
49 | this.timeout(30000) | 49 | this.timeout(120000) |
50 | serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { | 50 | serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { |
51 | servers = serversRun | 51 | servers = serversRun |
52 | 52 | ||
diff --git a/server/tests/api/friends-basic.js b/server/tests/api/friends-basic.js index 658e54829..4c2043b39 100644 --- a/server/tests/api/friends-basic.js +++ b/server/tests/api/friends-basic.js | |||
@@ -47,7 +47,7 @@ describe('Test basic friends', function () { | |||
47 | // --------------------------------------------------------------- | 47 | // --------------------------------------------------------------- |
48 | 48 | ||
49 | before(function (done) { | 49 | before(function (done) { |
50 | this.timeout(20000) | 50 | this.timeout(120000) |
51 | serversUtils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { | 51 | serversUtils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { |
52 | servers = serversRun | 52 | servers = serversRun |
53 | 53 | ||
@@ -76,7 +76,7 @@ describe('Test basic friends', function () { | |||
76 | }) | 76 | }) |
77 | 77 | ||
78 | it('Should make friends', function (done) { | 78 | it('Should make friends', function (done) { |
79 | this.timeout(40000) | 79 | this.timeout(120000) |
80 | 80 | ||
81 | series([ | 81 | series([ |
82 | // The second pod make friend with the third | 82 | // The second pod make friend with the third |
@@ -142,11 +142,14 @@ describe('Test basic friends', function () { | |||
142 | }) | 142 | }) |
143 | 143 | ||
144 | it('Should not be allowed to make friend again', function (done) { | 144 | it('Should not be allowed to make friend again', function (done) { |
145 | this.timeout(10000) | ||
145 | const server = servers[1] | 146 | const server = servers[1] |
146 | podsUtils.makeFriends(server.url, server.accessToken, 409, done) | 147 | podsUtils.makeFriends(server.url, server.accessToken, 409, done) |
147 | }) | 148 | }) |
148 | 149 | ||
149 | it('Should quit friends of pod 2', function (done) { | 150 | it('Should quit friends of pod 2', function (done) { |
151 | this.timeout(10000) | ||
152 | |||
150 | series([ | 153 | series([ |
151 | // Pod 1 quit friends | 154 | // Pod 1 quit friends |
152 | function (next) { | 155 | function (next) { |
@@ -183,7 +186,7 @@ describe('Test basic friends', function () { | |||
183 | }) | 186 | }) |
184 | 187 | ||
185 | it('Should allow pod 2 to make friend again', function (done) { | 188 | it('Should allow pod 2 to make friend again', function (done) { |
186 | this.timeout(20000) | 189 | this.timeout(120000) |
187 | 190 | ||
188 | const server = servers[1] | 191 | const server = servers[1] |
189 | podsUtils.makeFriends(server.url, server.accessToken, function () { | 192 | podsUtils.makeFriends(server.url, server.accessToken, function () { |
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index c1b5fc9f5..c3ee77f0c 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -22,7 +22,7 @@ describe('Test multiple pods', function () { | |||
22 | const toRemove = [] | 22 | const toRemove = [] |
23 | 23 | ||
24 | before(function (done) { | 24 | before(function (done) { |
25 | this.timeout(30000) | 25 | this.timeout(120000) |
26 | 26 | ||
27 | series([ | 27 | series([ |
28 | // Run servers | 28 | // Run servers |
@@ -230,7 +230,7 @@ describe('Test multiple pods', function () { | |||
230 | }) | 230 | }) |
231 | 231 | ||
232 | it('Should upload two videos on pod 3 and propagate on each pod', function (done) { | 232 | it('Should upload two videos on pod 3 and propagate on each pod', function (done) { |
233 | this.timeout(30000) | 233 | this.timeout(45000) |
234 | 234 | ||
235 | series([ | 235 | series([ |
236 | function (next) { | 236 | function (next) { |
@@ -260,7 +260,7 @@ describe('Test multiple pods', function () { | |||
260 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) | 260 | videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) |
261 | }, | 261 | }, |
262 | function (next) { | 262 | function (next) { |
263 | setTimeout(next, 22000) | 263 | setTimeout(next, 33000) |
264 | }], | 264 | }], |
265 | function (err) { | 265 | function (err) { |
266 | if (err) throw err | 266 | if (err) throw err |
diff --git a/server/tests/api/request-schedulers.js b/server/tests/api/request-schedulers.js index c5c443f14..c5ea72a6a 100644 --- a/server/tests/api/request-schedulers.js +++ b/server/tests/api/request-schedulers.js | |||
@@ -37,7 +37,7 @@ describe('Test requests schedulers stats', function () { | |||
37 | // --------------------------------------------------------------- | 37 | // --------------------------------------------------------------- |
38 | 38 | ||
39 | before(function (done) { | 39 | before(function (done) { |
40 | this.timeout(20000) | 40 | this.timeout(120000) |
41 | serversUtils.flushAndRunMultipleServers(2, function (serversRun, urlsRun) { | 41 | serversUtils.flushAndRunMultipleServers(2, function (serversRun, urlsRun) { |
42 | servers = serversRun | 42 | servers = serversRun |
43 | 43 | ||
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index fe388698f..e08da0517 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -22,7 +22,7 @@ describe('Test a single pod', function () { | |||
22 | let videosListBase = null | 22 | let videosListBase = null |
23 | 23 | ||
24 | before(function (done) { | 24 | before(function (done) { |
25 | this.timeout(20000) | 25 | this.timeout(120000) |
26 | 26 | ||
27 | series([ | 27 | series([ |
28 | function (next) { | 28 | function (next) { |
@@ -181,7 +181,8 @@ describe('Test a single pod', function () { | |||
181 | if (err) throw err | 181 | if (err) throw err |
182 | expect(test).to.equal(true) | 182 | expect(test).to.equal(true) |
183 | 183 | ||
184 | done() | 184 | // Wait the async views increment |
185 | setTimeout(done, 500) | ||
185 | }) | 186 | }) |
186 | }) | 187 | }) |
187 | }) | 188 | }) |
diff --git a/server/tests/api/users.js b/server/tests/api/users.js index 10c96baeb..74477ae2d 100644 --- a/server/tests/api/users.js +++ b/server/tests/api/users.js | |||
@@ -21,7 +21,7 @@ describe('Test users', function () { | |||
21 | let userId = null | 21 | let userId = null |
22 | 22 | ||
23 | before(function (done) { | 23 | before(function (done) { |
24 | this.timeout(20000) | 24 | this.timeout(120000) |
25 | 25 | ||
26 | series([ | 26 | series([ |
27 | function (next) { | 27 | function (next) { |
diff --git a/server/tests/api/video-abuse.js b/server/tests/api/video-abuse.js index c2b6186bd..be35a361d 100644 --- a/server/tests/api/video-abuse.js +++ b/server/tests/api/video-abuse.js | |||
@@ -17,7 +17,7 @@ describe('Test video abuses', function () { | |||
17 | let servers = [] | 17 | let servers = [] |
18 | 18 | ||
19 | before(function (done) { | 19 | before(function (done) { |
20 | this.timeout(40000) | 20 | this.timeout(100000) |
21 | 21 | ||
22 | series([ | 22 | series([ |
23 | // Run servers | 23 | // Run servers |
diff --git a/server/tests/api/video-blacklist.js b/server/tests/api/video-blacklist.js index 20b7c5de3..79a2fec8d 100644 --- a/server/tests/api/video-blacklist.js +++ b/server/tests/api/video-blacklist.js | |||
@@ -17,7 +17,7 @@ describe('Test video blacklists', function () { | |||
17 | let servers = [] | 17 | let servers = [] |
18 | 18 | ||
19 | before(function (done) { | 19 | before(function (done) { |
20 | this.timeout(40000) | 20 | this.timeout(120000) |
21 | 21 | ||
22 | series([ | 22 | series([ |
23 | // Run servers | 23 | // Run servers |