mirror of
https://github.com/grafana/grafana.git
synced 2025-01-04 13:17:16 -06:00
test(alerting): make sure the worst state is captured
This commit is contained in:
parent
6cb4bdd6cb
commit
04436c8a52
@ -91,7 +91,7 @@ func TestAlertingExecutor(t *testing.T) {
|
||||
}
|
||||
|
||||
timeSeries := []*tsdb.TimeSeries{
|
||||
tsdb.NewTimeSeries("test1", [][2]float64{{1, 0}, {11, 0}}),
|
||||
tsdb.NewTimeSeries("test1", [][2]float64{{6, 0}, {11, 0}}),
|
||||
}
|
||||
|
||||
result := executor.evaluateRule(rule, timeSeries)
|
||||
@ -130,6 +130,22 @@ func TestAlertingExecutor(t *testing.T) {
|
||||
result := executor.evaluateRule(rule, timeSeries)
|
||||
So(result.State, ShouldEqual, alertstates.Critical)
|
||||
})
|
||||
|
||||
Convey("first serie is warn, second is critical", func() {
|
||||
rule := &AlertRule{
|
||||
Critical: Level{Level: 10, Operator: ">"},
|
||||
Warning: Level{Level: 5, Operator: ">"},
|
||||
Transformer: transformers.NewAggregationTransformer("avg"),
|
||||
}
|
||||
|
||||
timeSeries := []*tsdb.TimeSeries{
|
||||
tsdb.NewTimeSeries("test1", [][2]float64{{6, 0}}),
|
||||
tsdb.NewTimeSeries("test1", [][2]float64{{11, 0}}),
|
||||
}
|
||||
|
||||
result := executor.evaluateRule(rule, timeSeries)
|
||||
So(result.State, ShouldEqual, alertstates.Critical)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user