diff --git a/pkg/test/metrics/metric.go b/pkg/test/metrics/metric.go index 98b51d74..f76e002a 100644 --- a/pkg/test/metrics/metric.go +++ b/pkg/test/metrics/metric.go @@ -13,11 +13,15 @@ func AssertMetricsCounterEquals(t *testing.T, expected int, c prometheus.Counter } func AssertCounterEqualsInt(t *testing.T, expected int, c prometheus.Counter) { - assert.Equal(t, expected, int(promtestutil.ToFloat64(c))) + assert.Equal(t, expected, GetCounterInt(c)) +} + +func GetCounterInt(c prometheus.Counter) int { + return int(promtestutil.ToFloat64(c)) } func AssertCounterGreaterOrEqualsInt(t *testing.T, threshold int, c prometheus.Counter) { - assert.GreaterOrEqual(t, int(promtestutil.ToFloat64(c)), threshold) + assert.GreaterOrEqual(t, GetCounterInt(c), threshold) } func AssertMetricsGaugeEquals(t *testing.T, expected int, g prometheus.Gauge, msgAndArgs ...interface{}) {