Alerting: Fix ConditionsCmd No Data for "has no value" (#58634)
This commit fixes a bug where ConditionsCmd returns No Data even when the condition checks for "has no value". It should return 1 with a nil match.
This commit is contained in:
@@ -203,9 +203,8 @@ func TestConditionsCmd(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expected: func() mathexp.Results {
|
||||
v := newNumber(nil)
|
||||
// This seems incorrect
|
||||
v.SetMeta([]EvalMatch{{}, {Metric: "NoData"}})
|
||||
v := newNumber(ptr.Float64(1))
|
||||
v.SetMeta([]EvalMatch{{Value: nil}})
|
||||
return newResults(v)
|
||||
},
|
||||
}, {
|
||||
@@ -226,9 +225,9 @@ func TestConditionsCmd(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expected: func() mathexp.Results {
|
||||
v := newNumber(nil)
|
||||
v := newNumber(ptr.Float64(1))
|
||||
// This too seems incorrect, looks like we don't call the evaluator
|
||||
v.SetMeta([]EvalMatch{{Metric: "NoData"}})
|
||||
v.SetMeta([]EvalMatch{{Value: nil}})
|
||||
return newResults(v)
|
||||
},
|
||||
}, {
|
||||
@@ -251,9 +250,9 @@ func TestConditionsCmd(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expected: func() mathexp.Results {
|
||||
v := newNumber(nil)
|
||||
v := newNumber(ptr.Float64(1))
|
||||
// This seems incorrect
|
||||
v.SetMeta([]EvalMatch{{}, {Metric: "NoData"}})
|
||||
v.SetMeta([]EvalMatch{{Value: nil}})
|
||||
return newResults(v)
|
||||
},
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user