Skip to content

Commit

Permalink
last try to make test works
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Redozubov authored and Civil committed Nov 18, 2024
1 parent 8bb9936 commit cdab347
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion expr/functions/countValues/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func New(_ string) []interfaces.FunctionMetadata {

const (
defaultValuesLimit = 32
LimitExceededMetricName = "error.too.many.values.limit.reached"
LimitExceededMetricName = "valuesLimitReached"
)

// countValues(seriesList)
Expand Down
12 changes: 8 additions & 4 deletions expr/functions/countValues/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)},
},
},
{
Expand All @@ -105,15 +109,15 @@ 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)},
},
},
}

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)
})
}

Expand Down

0 comments on commit cdab347

Please sign in to comment.