aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/requests.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/requests.js')
-rw-r--r--server/tests/api/requests.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/server/tests/api/requests.js b/server/tests/api/requests.js
index b4b8393e3..8762163af 100644
--- a/server/tests/api/requests.js
+++ b/server/tests/api/requests.js
@@ -13,17 +13,16 @@ const serversUtils = require('../utils/servers')
13const videosUtils = require('../utils/videos') 13const videosUtils = require('../utils/videos')
14 14
15describe('Test requests stats', function () { 15describe('Test requests stats', function () {
16 const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ]
16 const path = '/api/v1/requests/stats' 17 const path = '/api/v1/requests/stats'
17 let servers = [] 18 let servers = []
18 19
19 function uploadVideo (server, callback) { 20 function uploadVideo (server, callback) {
20 const name = 'my super video' 21 const videoAttributes = {
21 const category = 5 22 tags: [ 'tag1', 'tag2' ]
22 const description = 'my super description' 23 }
23 const tags = [ 'tag1', 'tag2' ]
24 const fixture = 'video_short.webm'
25 24
26 videosUtils.uploadVideo(server.url, server.accessToken, name, category, description, tags, fixture, callback) 25 videosUtils.uploadVideo(server.url, server.accessToken, videoAttributes, callback)
27 } 26 }
28 27
29 function getRequestsStats (server, callback) { 28 function getRequestsStats (server, callback) {
@@ -64,9 +63,13 @@ describe('Test requests stats', function () {
64 getRequestsStats(server, function (err, res) { 63 getRequestsStats(server, function (err, res) {
65 if (err) throw err 64 if (err) throw err
66 65
67 const body = res.body 66 const requestSchedulers = res.body
68 expect(body.remainingMilliSeconds).to.be.at.least(0) 67 for (const requestSchedulerName of requestSchedulerNames) {
69 expect(body.remainingMilliSeconds).to.be.at.most(10000) 68 const requestScheduler = requestSchedulers[requestSchedulerName]
69
70 expect(requestScheduler.remainingMilliSeconds).to.be.at.least(0)
71 expect(requestScheduler.remainingMilliSeconds).to.be.at.most(10000)
72 }
70 73
71 done() 74 done()
72 }) 75 })
@@ -86,8 +89,9 @@ describe('Test requests stats', function () {
86 getRequestsStats(server, function (err, res) { 89 getRequestsStats(server, function (err, res) {
87 if (err) throw err 90 if (err) throw err
88 91
89 const body = res.body 92 const requestSchedulers = res.body
90 expect(body.totalRequests).to.equal(1) 93 const requestScheduler = requestSchedulers.requestScheduler
94 expect(requestScheduler.totalRequests).to.equal(1)
91 95
92 done() 96 done()
93 }) 97 })