Skip to content

Commit

Permalink
Merge branch 'master' of github.com:codeready-toolchain/toolchain-com…
Browse files Browse the repository at this point in the history
…mon into k8s_1_27_common
  • Loading branch information
ranakan19 committed Aug 15, 2024
2 parents 9e0f843 + a209f6c commit ab92ad8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/test/metrics/metric.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package metrics

import (
"testing"

"github.com/prometheus/client_golang/prometheus"
promtestutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/assert"
)

func AssertMetricsCounterEquals(t *testing.T, expected int, c prometheus.Counter) {
assert.InDelta(t, float64(expected), promtestutil.ToFloat64(c), 0.01)
}

func AssertMetricsGaugeEquals(t *testing.T, expected int, g prometheus.Gauge, msgAndArgs ...interface{}) {
assert.InDelta(t, float64(expected), promtestutil.ToFloat64(g), 0.01, msgAndArgs...)
}

0 comments on commit ab92ad8

Please sign in to comment.