Skip to content

Commit 4732c3e

Browse files
committed
correcting testcases, add documentation
1 parent 1921ba9 commit 4732c3e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

alerting_alert_rule.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type RelativeTimeRange struct {
6464
To time.Duration `json:"to"`
6565
}
6666

67+
// AlertRules fetches and returns Grafana alertRules.
6768
func (c *Client) AlertRules() ([]AlertRule, error) {
6869
const limit = 1000
6970

alerting_alert_rule_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestAlertRules(t *testing.T) {
2020
{200, "[" + getFolderJSON + "]"},
2121
})
2222

23-
const dashCount = 2001
23+
const dashCount = 1000
2424

2525
alertRules, err := client.AlertRules()
2626
if err != nil {
@@ -32,11 +32,11 @@ func TestAlertRules(t *testing.T) {
3232
if len(alertRules) != dashCount {
3333
t.Errorf("Length of returned folders should be %d", dashCount)
3434
}
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.")
3737
}
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.")
4040
}
4141
}
4242

0 commit comments

Comments
 (0)