aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/request-schedulers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/request-schedulers.ts')
-rw-r--r--server/tests/api/request-schedulers.ts82
1 files changed, 0 insertions, 82 deletions
diff --git a/server/tests/api/request-schedulers.ts b/server/tests/api/request-schedulers.ts
deleted file mode 100644
index c136d1cea..000000000
--- a/server/tests/api/request-schedulers.ts
+++ /dev/null
@@ -1,82 +0,0 @@
1/* tslint:disable:no-unused-expression */
2
3import 'mocha'
4import * as chai from 'chai'
5const expect = chai.expect
6
7import {
8 ServerInfo,
9 flushTests,
10 uploadVideo,
11 makeFriends,
12 wait,
13 setAccessTokensToServers,
14 flushAndRunMultipleServers,
15 getRequestsStats,
16 killallServers
17} from '../utils'
18
19describe('Test requests schedulers stats', function () {
20 const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ]
21 let servers: ServerInfo[] = []
22
23 function uploadVideoWrapper (server: ServerInfo) {
24 const videoAttributes = {
25 tags: [ 'tag1', 'tag2' ]
26 }
27
28 return uploadVideo(server.url, server.accessToken, videoAttributes)
29 }
30
31 // ---------------------------------------------------------------
32
33 before(async function () {
34 this.timeout(120000)
35
36 servers = await flushAndRunMultipleServers(2)
37
38 await setAccessTokensToServers(servers)
39
40 await makeFriends(servers[0].url, servers[0].accessToken)
41 })
42
43 it('Should have a correct timer', async function () {
44 const server = servers[0]
45
46 const res = await getRequestsStats(server)
47
48 const requestSchedulers = res.body
49 for (const requestSchedulerName of requestSchedulerNames) {
50 const requestScheduler = requestSchedulers[requestSchedulerName]
51
52 expect(requestScheduler.remainingMilliSeconds).to.be.at.least(0)
53 expect(requestScheduler.remainingMilliSeconds).to.be.at.most(10000)
54 }
55 })
56
57 it('Should have the correct total request', async function () {
58 this.timeout(15000)
59
60 const server = servers[0]
61 // Ensure the requests of pod 1 won't be made
62 servers[1].app.kill()
63
64 await uploadVideoWrapper(server)
65
66 await wait(1000)
67
68 const res = await getRequestsStats(server)
69 const requestSchedulers = res.body
70 const requestScheduler = requestSchedulers.requestScheduler
71 expect(requestScheduler.totalRequests).to.equal(3)
72 })
73
74 after(async function () {
75 // Server 1 has already been killed
76 killallServers([ servers[0] ])
77
78 if (this['ok']) {
79 await flushTests()
80 }
81 })
82})