Alerting: Fix ConditionsCmd behavior when last is No Data (#58953)
This commit is contained in:
@@ -146,7 +146,6 @@ func (cmd *ConditionsCmd) Execute(_ context.Context, _ time.Time, vars mathexp.V
|
|||||||
matches = append(matches, EvalMatch{
|
matches = append(matches, EvalMatch{
|
||||||
Metric: "NoData",
|
Metric: "NoData",
|
||||||
})
|
})
|
||||||
noDataFound = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
firingCount = 0
|
firingCount = 0
|
||||||
|
|||||||
@@ -502,7 +502,6 @@ func TestConditionsCmd(t *testing.T) {
|
|||||||
return newResults(v)
|
return newResults(v)
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
// TODO: NoData behavior is different if the last condition is no data
|
|
||||||
name: "two queries with two conditions using and operator and last is No Data",
|
name: "two queries with two conditions using and operator and last is No Data",
|
||||||
vars: mathexp.Vars{
|
vars: mathexp.Vars{
|
||||||
"A": mathexp.Results{
|
"A": mathexp.Results{
|
||||||
@@ -529,7 +528,7 @@ func TestConditionsCmd(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: func() mathexp.Results {
|
expected: func() mathexp.Results {
|
||||||
v := newNumber(nil)
|
v := newNumber(ptr.Float64(0))
|
||||||
v.SetMeta([]EvalMatch{{Value: ptr.Float64(5)}, {Metric: "NoData"}})
|
v.SetMeta([]EvalMatch{{Value: ptr.Float64(5)}, {Metric: "NoData"}})
|
||||||
return newResults(v)
|
return newResults(v)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user