From e76c22efac65f0181dd1c7528ff2d30a405721f0 Mon Sep 17 00:00:00 2001 From: Egor Redozubov Date: Mon, 18 Nov 2024 18:35:10 +0100 Subject: [PATCH] last try to make test works --- expr/functions/countValues/function.go | 2 +- expr/functions/countValues/function_test.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/expr/functions/countValues/function.go b/expr/functions/countValues/function.go index cb82665d1..131221bff 100755 --- a/expr/functions/countValues/function.go +++ b/expr/functions/countValues/function.go @@ -31,7 +31,7 @@ func New(_ string) []interfaces.FunctionMetadata { const ( defaultValuesLimit = 32 - LimitExceededMetricName = "error.too.many.values.limit.reached" + LimitExceededMetricName = "valuesLimitReached" ) // countValues(seriesList) diff --git a/expr/functions/countValues/function_test.go b/expr/functions/countValues/function_test.go index 20d0972d5..fa3fa1748 100755 --- a/expr/functions/countValues/function_test.go +++ b/expr/functions/countValues/function_test.go @@ -5,14 +5,18 @@ import ( "testing" "time" + "github.com/go-graphite/carbonapi/expr/interfaces" "github.com/go-graphite/carbonapi/expr/metadata" "github.com/go-graphite/carbonapi/expr/types" "github.com/go-graphite/carbonapi/pkg/parser" th "github.com/go-graphite/carbonapi/tests" ) +var ( + md []interfaces.FunctionMetadata = New("") +) + func init() { - md := New("") for _, m := range md { metadata.RegisterFunction(m.Name, m.F) } @@ -90,7 +94,7 @@ func TestCountValues(t *testing.T) { }, "countValues", map[string][]*types.MetricData{ - LimitExceededMetricName: {types.MakeMetricData(LimitExceededMetricName, []float64{0, 0, 0, 0, 0}, 1, now32)}, + "valuesLimitReached": {types.MakeMetricData("valuesLimitReached", []float64{0, 0, 0, 0, 0}, 1, now32)}, }, }, { @@ -105,7 +109,7 @@ func TestCountValues(t *testing.T) { }, "countValues", map[string][]*types.MetricData{ - LimitExceededMetricName: {types.MakeMetricData(LimitExceededMetricName, []float64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1, now32)}, + "valuesLimitReached": {types.MakeMetricData("valuesLimitReached", []float64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1, now32)}, }, }, } @@ -113,7 +117,7 @@ func TestCountValues(t *testing.T) { for _, tt := range tests { t.Run(tt.Target, func(t *testing.T) { eval := th.EvaluatorFromFunc(md[0].F) - th.TestEvalExprWithRange(t, eval, &tt) + th.TestMultiReturnEvalExpr(t, eval, &tt) }) }