Skip to content

Commit

Permalink
Relax noise margin in TestOneWeightedHistogram
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>

Kubernetes-commit: 77541c1e35e10d16787fe5951e5014195bfbf09f
  • Loading branch information
MikeSpreitzer authored and k8s-publishing-bot committed Jul 24, 2024
1 parent 95f30f1 commit d64a96d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions metrics/prometheusextension/weighted_histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func exerciseWeightedHistograms(t *testing.T, whSpecs ...weightedHistogramSpecFu
for _, term := range terms {
ee.sum += term
}
t.Logf("Adding expectation %#+v", ee)
t.Logf("At idx=%v, adding expectation of buckets=%#+v, upperBounds=%#+v, sum=%v, count=%v", whIdx, ee.buckets, ee.upperBounds, ee.sum, ee.count)
expectations = append(expectations, ee)
}
// Do the planned calls on ObserveWithWeight, in randomized order
Expand Down Expand Up @@ -142,8 +142,10 @@ func exerciseWeightedHistograms(t *testing.T, whSpecs ...weightedHistogramSpecFu
actualSum := actualHist.GetSampleSum()
num := math.Abs(actualSum - ee.sum)
den := math.Max(math.Abs(actualSum), math.Abs(ee.sum))
if num > den/1e14 {
t.Errorf("At idx=%d, expected sum %v but got %v, err=%v", idx, ee.sum, actualSum, actualSum-ee.sum)
relErr := num / den
// Issue 120112 reports relative errors as high as 9.55994394104272e-14
if relErr > 1e-13 {
t.Errorf("At idx=%d, expected sum %v but got %v, err=%v, relativeErr=%v", idx, ee.sum, actualSum, actualSum-ee.sum, relErr)
}
}
}
Expand Down

0 comments on commit d64a96d

Please sign in to comment.