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.
This commit is contained in:
Green-Star 2017-07-02 20:48:31 +02:00 committed by Bigard Florian
parent ba44fa1953
commit 5fe7e89831
12 changed files with 22 additions and 17 deletions

View File

@ -23,7 +23,7 @@ describe('Test users API validators', function () {
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
series([ series([
function (next) { function (next) {

View File

@ -17,7 +17,7 @@ describe('Test video blacklists API validators', function () {
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
series([ series([
function (next) { function (next) {

View File

@ -378,7 +378,7 @@ describe('Test videos API validator', function () {
}) })
it('Should succeed with the correct parameters', function (done) { it('Should succeed with the correct parameters', function (done) {
this.timeout(5000) this.timeout(10000)
const data = { const data = {
name: 'my super name', name: 'my super name',
@ -392,6 +392,7 @@ describe('Test videos API validator', function () {
const attach = { const attach = {
'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
} }
requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () {
attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4') attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4')
requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () {

View File

@ -13,7 +13,7 @@ describe('Test config', function () {
let server = null let server = null
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
series([ series([
function (next) { function (next) {

View File

@ -46,7 +46,7 @@ describe('Test advanced friends', function () {
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(function (done) { before(function (done) {
this.timeout(30000) this.timeout(120000)
serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) { serversUtils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) {
servers = serversRun servers = serversRun

View File

@ -47,7 +47,7 @@ describe('Test basic friends', function () {
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
serversUtils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) { serversUtils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) {
servers = serversRun servers = serversRun
@ -76,7 +76,7 @@ describe('Test basic friends', function () {
}) })
it('Should make friends', function (done) { it('Should make friends', function (done) {
this.timeout(40000) this.timeout(120000)
series([ series([
// The second pod make friend with the third // 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) { it('Should not be allowed to make friend again', function (done) {
this.timeout(10000)
const server = servers[1] const server = servers[1]
podsUtils.makeFriends(server.url, server.accessToken, 409, done) podsUtils.makeFriends(server.url, server.accessToken, 409, done)
}) })
it('Should quit friends of pod 2', function (done) { it('Should quit friends of pod 2', function (done) {
this.timeout(10000)
series([ series([
// Pod 1 quit friends // Pod 1 quit friends
function (next) { function (next) {
@ -183,7 +186,7 @@ describe('Test basic friends', function () {
}) })
it('Should allow pod 2 to make friend again', function (done) { it('Should allow pod 2 to make friend again', function (done) {
this.timeout(20000) this.timeout(120000)
const server = servers[1] const server = servers[1]
podsUtils.makeFriends(server.url, server.accessToken, function () { podsUtils.makeFriends(server.url, server.accessToken, function () {

View File

@ -22,7 +22,7 @@ describe('Test multiple pods', function () {
const toRemove = [] const toRemove = []
before(function (done) { before(function (done) {
this.timeout(30000) this.timeout(120000)
series([ series([
// Run servers // 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) { it('Should upload two videos on pod 3 and propagate on each pod', function (done) {
this.timeout(30000) this.timeout(45000)
series([ series([
function (next) { function (next) {
@ -260,7 +260,7 @@ describe('Test multiple pods', function () {
videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next) videosUtils.uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes, next)
}, },
function (next) { function (next) {
setTimeout(next, 22000) setTimeout(next, 33000)
}], }],
function (err) { function (err) {
if (err) throw err if (err) throw err

View File

@ -37,7 +37,7 @@ describe('Test requests schedulers stats', function () {
// --------------------------------------------------------------- // ---------------------------------------------------------------
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
serversUtils.flushAndRunMultipleServers(2, function (serversRun, urlsRun) { serversUtils.flushAndRunMultipleServers(2, function (serversRun, urlsRun) {
servers = serversRun servers = serversRun

View File

@ -22,7 +22,7 @@ describe('Test a single pod', function () {
let videosListBase = null let videosListBase = null
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
series([ series([
function (next) { function (next) {
@ -181,7 +181,8 @@ describe('Test a single pod', function () {
if (err) throw err if (err) throw err
expect(test).to.equal(true) expect(test).to.equal(true)
done() // Wait the async views increment
setTimeout(done, 500)
}) })
}) })
}) })

View File

@ -21,7 +21,7 @@ describe('Test users', function () {
let userId = null let userId = null
before(function (done) { before(function (done) {
this.timeout(20000) this.timeout(120000)
series([ series([
function (next) { function (next) {

View File

@ -17,7 +17,7 @@ describe('Test video abuses', function () {
let servers = [] let servers = []
before(function (done) { before(function (done) {
this.timeout(40000) this.timeout(100000)
series([ series([
// Run servers // Run servers

View File

@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
let servers = [] let servers = []
before(function (done) { before(function (done) {
this.timeout(40000) this.timeout(120000)
series([ series([
// Run servers // Run servers