From 5fe7e898316e18369c3e1aba307b55077adc7bfb Mon Sep 17 00:00:00 2001 From: Green-Star Date: Sun, 2 Jul 2017 20:48:31 +0200 Subject: 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. --- server/tests/api/check-params/users.js | 2 +- server/tests/api/check-params/video-blacklists.js | 2 +- server/tests/api/check-params/videos.js | 3 ++- server/tests/api/config.js | 2 +- server/tests/api/friends-advanced.js | 2 +- server/tests/api/friends-basic.js | 9 ++++++--- server/tests/api/multiple-pods.js | 6 +++--- server/tests/api/request-schedulers.js | 2 +- server/tests/api/single-pod.js | 5 +++-- server/tests/api/users.js | 2 +- server/tests/api/video-abuse.js | 2 +- server/tests/api/video-blacklist.js | 2 +- 12 files changed, 22 insertions(+), 17 deletions(-) (limited to 'server/tests') 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 () { // --------------------------------------------------------------- before(function (done) { - this.timeout(20000) + this.timeout(120000) series([ 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 () { // --------------------------------------------------------------- before(function (done) { - this.timeout(20000) + this.timeout(120000) series([ 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 () { }) it('Should succeed with the correct parameters', function (done) { - this.timeout(5000) + this.timeout(10000) const data = { name: 'my super name', @@ -392,6 +392,7 @@ describe('Test videos API validator', function () { const attach = { 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') } + requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4') 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 () { let server = null before(function (done) { - this.timeout(20000) + this.timeout(120000) series([ 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 () { // --------------------------------------------------------------- before(function (done) { - this.timeout(30000) + this.timeout(120000) serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { servers = serversRun 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 () { // --------------------------------------------------------------- before(function (done) { - this.timeout(20000) + this.timeout(120000) serversUtils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { servers = serversRun @@ -76,7 +76,7 @@ describe('Test basic friends', function () { }) it('Should make friends', function (done) { - this.timeout(40000) + this.timeout(120000) series([ // The second pod make friend with the third @@ -142,11 +142,14 @@ describe('Test basic friends', function () { }) it('Should not be allowed to make friend again', function (done) { + this.timeout(10000) const server = servers[1] podsUtils.makeFriends(server.url, server.accessToken, 409, done) }) it('Should quit friends of pod 2', function (done) { + this.timeout(10000) + series([ // Pod 1 quit friends function (next) { @@ -183,7 +186,7 @@ describe('Test basic friends', function () { }) it('Should allow pod 2 to make friend again', function (done) { - this.timeout(20000) + this.timeout(120000) const server = servers[1] 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 () { const toRemove = [] before(function (done) { - this.timeout(30000) + this.timeout(120000) series([ // Run servers @@ -230,7 +230,7 @@ describe('Test multiple pods', function () { }) it('Should upload two videos on pod 3 and propagate on each pod', function (done) { - this.timeout(30000) + this.timeout(45000) series([ function (next) { @@ -260,7 +260,7 @@ describe('Test multiple pods', function () { videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) }, function (next) { - setTimeout(next, 22000) + setTimeout(next, 33000) }], function (err) { 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 () { // --------------------------------------------------------------- before(function (done) { - this.timeout(20000) + this.timeout(120000) serversUtils.flushAndRunMultipleServers(2, function (serversRun, urlsRun) { servers = serversRun 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 () { let videosListBase = null before(function (done) { - this.timeout(20000) + this.timeout(120000) series([ function (next) { @@ -181,7 +181,8 @@ describe('Test a single pod', function () { if (err) throw err expect(test).to.equal(true) - done() + // Wait the async views increment + setTimeout(done, 500) }) }) }) 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 () { let userId = null before(function (done) { - this.timeout(20000) + this.timeout(120000) series([ 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 () { let servers = [] before(function (done) { - this.timeout(40000) + this.timeout(100000) series([ // 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 () { let servers = [] before(function (done) { - this.timeout(40000) + this.timeout(120000) series([ // Run servers -- cgit v1.2.3