mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
Alerting: Fix use of > instead of >= when checking the For duration (#46011)
This commit is contained in:
parent
703d7deeda
commit
789cfc31e3
@ -552,7 +552,7 @@ func TestProcessEvalResults(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedAnnotations: 2,
|
||||
expectedAnnotations: 3,
|
||||
expectedStates: map[string]*state.State{
|
||||
`[["__alert_rule_namespace_uid__","test_namespace_uid"],["__alert_rule_uid__","test_alert_rule_uid_2"],["alertname","test_title"],["instance_label","test"],["label","test"]]`: {
|
||||
AlertRuleUID: "test_alert_rule_uid_2",
|
||||
@ -578,7 +578,7 @@ func TestProcessEvalResults(t *testing.T) {
|
||||
Values: make(map[string]*float64),
|
||||
},
|
||||
},
|
||||
StartsAt: evaluationTime,
|
||||
StartsAt: evaluationTime.Add(20 * time.Second),
|
||||
EndsAt: evaluationTime.Add(30 * time.Second).Add(state.ResendDelay * 3),
|
||||
LastEvaluationTime: evaluationTime.Add(30 * time.Second),
|
||||
EvaluationDuration: evaluationDuration,
|
||||
|
@ -64,7 +64,7 @@ func (a *State) resultAlerting(alertRule *ngModels.AlertRule, result eval.Result
|
||||
case eval.Alerting:
|
||||
a.setEndsAt(alertRule, result)
|
||||
case eval.Pending:
|
||||
if result.EvaluatedAt.Sub(a.StartsAt) > alertRule.For {
|
||||
if result.EvaluatedAt.Sub(a.StartsAt) >= alertRule.For {
|
||||
a.State = eval.Alerting
|
||||
a.StartsAt = result.EvaluatedAt
|
||||
a.setEndsAt(alertRule, result)
|
||||
|
Loading…
Reference in New Issue
Block a user