From 110fdf4da9704a7e34d57042c1cd4bb26e57f418 Mon Sep 17 00:00:00 2001 From: George Robinson Date: Mon, 28 Nov 2022 21:56:22 +0000 Subject: [PATCH] Alerting: Fix ConditionsCmd behavior when last is No Data (#58953) --- pkg/expr/classic/classic.go | 1 - pkg/expr/classic/classic_test.go | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/expr/classic/classic.go b/pkg/expr/classic/classic.go index 33e57d5e6a5..29e376238d6 100644 --- a/pkg/expr/classic/classic.go +++ b/pkg/expr/classic/classic.go @@ -146,7 +146,6 @@ func (cmd *ConditionsCmd) Execute(_ context.Context, _ time.Time, vars mathexp.V matches = append(matches, EvalMatch{ Metric: "NoData", }) - noDataFound = true } firingCount = 0 diff --git a/pkg/expr/classic/classic_test.go b/pkg/expr/classic/classic_test.go index fd656b2de4a..de159f32f21 100644 --- a/pkg/expr/classic/classic_test.go +++ b/pkg/expr/classic/classic_test.go @@ -502,7 +502,6 @@ func TestConditionsCmd(t *testing.T) { 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", vars: mathexp.Vars{ "A": mathexp.Results{ @@ -529,7 +528,7 @@ func TestConditionsCmd(t *testing.T) { }, }, expected: func() mathexp.Results { - v := newNumber(nil) + v := newNumber(ptr.Float64(0)) v.SetMeta([]EvalMatch{{Value: ptr.Float64(5)}, {Metric: "NoData"}}) return newResults(v) },