diff --git a/tests/testutils/telemetry/metrics.go b/tests/testutils/telemetry/metrics.go index e8e7722d04..1bcc8a3b7e 100644 --- a/tests/testutils/telemetry/metrics.go +++ b/tests/testutils/telemetry/metrics.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/knadh/koanf/maps" + "github.com/stretchr/testify/assert" "gopkg.in/yaml.v2" "github.com/signalfx/splunk-otel-collector/tests/internal/version" @@ -256,23 +257,13 @@ func (metric Metric) equals(toCompare Metric, strict bool) bool { return false } - if !valuesEqual(metric.Value, toCompare.Value) && (strict || metric.Value != nil) { + if !assert.ObjectsAreEqualValues(metric.Value, toCompare.Value) && (strict || metric.Value != nil) { return false } return attributesAreEqual(metric.Attributes, toCompare.Attributes) } -func valuesEqual(value any, toCompare any) bool { - if i, ok := value.(int); ok { - value = int64(i) - } - if i, ok := toCompare.(int); ok { - toCompare = int64(i) - } - return value == toCompare -} - // FlattenResourceMetrics takes multiple instances of ResourceMetrics and flattens them // to only unique entries by Resource, InstrumentationScope, and Metric content. // It will preserve order by removing subsequent occurrences of repeated items