Use "InDelta" to compare values where expected could be "0".

This commit is contained in:
Joachim Bauch 2025-12-09 10:17:36 +01:00
commit 0960a714aa
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -71,7 +71,7 @@ func checkStatsValue(t *testing.T, collector prometheus.Collector, value float64
pc := make([]uintptr, 10)
n := runtime.Callers(2, pc)
if n == 0 {
assert.InEpsilon(value, v, 0.0001, "failed for %s", desc)
assert.InDelta(value, v, 0.0001, "failed for %s", desc)
return
}
@ -88,7 +88,7 @@ func checkStatsValue(t *testing.T, collector prometheus.Collector, value float64
break
}
}
assert.InEpsilon(value, v, 0.0001, "Unexpected value for %s at\n%s", desc, stack.String())
assert.InDelta(value, v, 0.0001, "Unexpected value for %s at\n%s", desc, stack.String())
}
}