-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e.prom.reader.js
104 lines (96 loc) · 4.34 KB
/
e2e.prom.reader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const axios = require('axios')
const {clokiExtUrl, _it, testID, clokiWriteUrl, shard, axiosPost, extraHeaders} = require('./common')
/* TODO: implement _it('should post /api/v1/labels with empty result', async () => {
let fd = new URLSearchParams()
fd.append('end', `${Math.floor(Date.now() / 1000)}`)
fd.append('start', `${Math.floor((Date.now() - 1 * 3600 * 1000) / 1000)}`)
let labels = await axiosPost(`http://${clokiExtUrl}/api/v1/labels`, fd, {
headers: {
'X-Scope-OrgID': '1',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
expect(labels.data.data.find(d => d===`${testID}_LBL`)).toBeTruthy()
fd = new URLSearchParams()
fd.append('start', `${Math.floor((Date.now() - 25 * 3600 * 1000) / 1000)}`)
fd.append('end', `${Math.floor((Date.now() - 24 * 3600 * 1000) / 1000)}`)
labels = await axiosPost(`http://${clokiExtUrl}/api/v1/labels`, fd, {
headers: {
'X-Scope-OrgID': '1',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
expect(labels.data.data.find(d => d===`${testID}_LBL`)).toBeFalsy()
}, ['should post /api/v1/labels']) */
/* TODO: implement _it('should get /api/v1/labels with empty result', async () => {
let fd = new URLSearchParams()
fd.append('end', `${Math.floor(Date.now() / 1000)}`)
fd.append('start', `${Math.floor((Date.now() - 3600 * 1000) / 1000)}`)
let labels = await axios.get(`http://${clokiExtUrl}/api/v1/labels?${fd}`, {
headers: {
'X-Scope-OrgID': '1',
...extraHeaders
}
})
expect(labels.data.data.find(d => d===`${testID}_LBL`)).toBeTruthy()
fd = new URLSearchParams()
fd.append('start', `${Math.floor((Date.now() - 25 * 3600 * 1000) / 1000)}`)
fd.append('end', `${Math.floor((Date.now() - 24 * 3600 * 1000) / 1000)}`)
console.log(`--------------------- http://${clokiExtUrl}/api/v1/labels?${fd}`)
labels = await axios.get(`http://${clokiExtUrl}/api/v1/labels?${fd}`, {
headers: {
'X-Scope-OrgID': '1',
...extraHeaders
}
})
expect(labels.data.data.find(d => d===`${testID}_LBL`)).toBeFalsy()
}, ['should post /api/v1/labels']) */
/* TODO: implement _it('should post /api/v1/series with time context', async () => {
let fd = new URLSearchParams()
fd.append('match[]', `{test_id="${testID}"}`)
fd.append('end', `${Math.floor(Date.now() / 1000)}`)
fd.append('start', `${Math.floor((Date.now() - 3600 * 1000) / 1000)}`)
let labels = await axiosPost(`http://${clokiExtUrl}/api/v1/series`, fd, {
headers: {
'X-Scope-OrgID': '1',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
expect(labels.data.data && labels.data.data.length).toBeTruthy()
fd = new URLSearchParams()
fd.append('match[]', `{test_id="${testID}"}`)
fd.append('start', `${Math.floor((Date.now() - 25 * 3600 * 1000) / 1000)}`)
fd.append('end', `${Math.floor((Date.now() - 24 * 3600 * 1000) / 1000)}`)
labels = await axiosPost(`http://${clokiExtUrl}/api/v1/series`, fd, {
headers: {
'X-Scope-OrgID': '1',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
expect(labels.data.data && labels.data.data.length).toBeFalsy()
}, ['should post /api/v1/labels'])*/
/* TODO: implement _it('should get /api/v1/series with time context', async () => {
let fd = new URLSearchParams()
fd.append('match[]', `{test_id="${testID}"}`)
fd.append('end', `${Math.floor(Date.now() / 1000)}`)
fd.append('start', `${Math.floor((Date.now() - 3600 * 1000) / 1000)}`)
let labels = await axios.get(`http://${clokiExtUrl}/api/v1/series?${fd}`, {
headers: {
'X-Scope-OrgID': '1',
...extraHeaders
}
})
expect(labels.data.data && labels.data.data.length).toBeTruthy()
fd = new URLSearchParams()
fd.append('match[]', `{test_id="${testID}"}`)
fd.append('start', `${Math.floor((Date.now() - 25 * 3600 * 1000) / 1000)}`)
fd.append('end', `${Math.floor((Date.now() - 24 * 3600 * 1000) / 1000)}`)
labels = await axios.get(`http://${clokiExtUrl}/api/v1/series?${fd}`, {
headers: {
'X-Scope-OrgID': '1',
...extraHeaders
}
})
expect(labels.data.data && labels.data.data.length).toBeFalsy()
}, ['should post /api/v1/labels'])
*/