From 5b1160f58203e000637b68600c19c6697756af76 Mon Sep 17 00:00:00 2001 From: Tony Holdstock-Brown Date: Wed, 31 Jan 2024 10:23:19 -0800 Subject: [PATCH] Fix flaky test with false positives --- expr_test.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/expr_test.go b/expr_test.go index 304a7bd..7b00a8e 100644 --- a/expr_test.go +++ b/expr_test.go @@ -264,10 +264,14 @@ func TestAggregateMatch(t *testing.T) { require.NoError(t, err) // False positives increase matches. // require.EqualValues(t, 1, len(matched)) - require.EqualValues(t, - `event.data.a == "yes"`, - matched[0].Parsed.Evaluable.GetExpression(), - ) + found := false + for _, item := range matched { + if item.Parsed.Evaluable.GetExpression() == `event.data.a == "yes"` { + found = true + break + } + } + require.True(t, found) }) // When passing input.data.b, we should match only one expression.