-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e.alert.config.js
40 lines (37 loc) · 1.33 KB
/
e2e.alert.config.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
const {_it, clokiExtUrl, axiosGet, axiosDelete, axiosPost } = require("./common");
const yaml = require('yaml')
_it('should send alerts', async () => {
expect(await axiosPost(`http://${clokiExtUrl}/api/prom/rules/test_ns`,yaml.stringify({
name: 'test_group',
interval: '1s',
rules: [{
alert: 'test_rul',
for: '1m',
annotations: { summary: 'ssssss' },
labels: { lllll: 'vvvvv' },
expr: '{test_id="alert_test"}'
}]
}), {
headers: {
'Content-Type': 'application/yaml'
}
})).toHaveProperty('data', { msg: 'ok' })
})
_it('should read alerts', async () => {
expect(yaml.parse((await axiosGet(`http://${clokiExtUrl}/api/prom/rules`)).data))
.toHaveProperty('test_ns', [{
name: 'test_group',
interval: '1s',
rules: [{
alert: 'test_rul',
for: '1m',
annotations: { summary: 'ssssss' },
labels: { lllll: 'vvvvv' },
expr: '{test_id="alert_test"}'
}]
}])
}, ['should send alerts'])
_it('should remove alerts', async () => {
expect(await axiosDelete(`http://${clokiExtUrl}/api/prom/rules/test_ns`))
.toHaveProperty('status', 200)
}, ['should read alerts', 'should send alerts']);