mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Relax noise margin in TestOneWeightedHistogram
Signed-off-by: Mike Spreitzer <mspreitz@us.ibm.com>
This commit is contained in:
parent
696ad19801
commit
77541c1e35
@ -99,7 +99,7 @@ func exerciseWeightedHistograms(t *testing.T, whSpecs ...weightedHistogramSpecFu
|
|||||||
for _, term := range terms {
|
for _, term := range terms {
|
||||||
ee.sum += term
|
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)
|
expectations = append(expectations, ee)
|
||||||
}
|
}
|
||||||
// Do the planned calls on ObserveWithWeight, in randomized order
|
// Do the planned calls on ObserveWithWeight, in randomized order
|
||||||
@ -142,8 +142,10 @@ func exerciseWeightedHistograms(t *testing.T, whSpecs ...weightedHistogramSpecFu
|
|||||||
actualSum := actualHist.GetSampleSum()
|
actualSum := actualHist.GetSampleSum()
|
||||||
num := math.Abs(actualSum - ee.sum)
|
num := math.Abs(actualSum - ee.sum)
|
||||||
den := math.Max(math.Abs(actualSum), math.Abs(ee.sum))
|
den := math.Max(math.Abs(actualSum), math.Abs(ee.sum))
|
||||||
if num > den/1e14 {
|
relErr := num / den
|
||||||
t.Errorf("At idx=%d, expected sum %v but got %v, err=%v", idx, ee.sum, actualSum, actualSum-ee.sum)
|
// 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user