File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ type RelativeTimeRange struct {
64
64
To time.Duration `json:"to"`
65
65
}
66
66
67
+ // AlertRules fetches and returns Grafana alertRules.
67
68
func (c * Client ) AlertRules () ([]AlertRule , error ) {
68
69
const limit = 1000
69
70
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ func TestAlertRules(t *testing.T) {
20
20
{200 , "[" + getFolderJSON + "]" },
21
21
})
22
22
23
- const dashCount = 2001
23
+ const dashCount = 1000
24
24
25
25
alertRules , err := client .AlertRules ()
26
26
if err != nil {
@@ -32,11 +32,11 @@ func TestAlertRules(t *testing.T) {
32
32
if len (alertRules ) != dashCount {
33
33
t .Errorf ("Length of returned folders should be %d" , dashCount )
34
34
}
35
- if alertRules [0 ].ID != 1 || alertRules [0 ].Title != "Departmenet ABC " {
36
- t .Error ("Not correctly parsing returned folders ." )
35
+ if alertRules [0 ].UID != "123abcd" || alertRules [0 ].Title != "Always in alarm " {
36
+ t .Error ("Not correctly parsing returned alertRules ." )
37
37
}
38
- if alertRules [dashCount - 1 ].ID != 1 || alertRules [dashCount - 1 ].Title != "Departmenet ABC " {
39
- t .Error ("Not correctly parsing returned folders ." )
38
+ if alertRules [dashCount - 1 ].UID != "123abcd" || alertRules [dashCount - 1 ].Title != "Always in alarm " {
39
+ t .Error ("Not correctly parsing returned alertRules ." )
40
40
}
41
41
}
42
42
You can’t perform that action at this time.
0 commit comments