Skip to content

Commit

Permalink
[Tests] Relax allowed delta in extended_stats aggregation (#30569)
Browse files Browse the repository at this point in the history
The order in which double values are added in java can give different results
for the sum, so we need to allow a certain delta in the test assertions. The
current value was still a bit too low, resulting in rare test failures. This
change increases the allowed margin of error by a factor of ten.
  • Loading branch information
Christoph Büscher authored May 15, 2018
1 parent 50c34b2 commit bf2fb21
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected void assertReduced(InternalExtendedStats reduced, List<InternalExtende
assertEquals(expectedCount, reduced.getCount());
// The order in which you add double values in java can give different results. The difference can
// be larger for large sum values, so we make the delta in the assertion depend on the values magnitude
assertEquals(expectedSum, reduced.getSum(), Math.abs(expectedSum) * 1e-11);
assertEquals(expectedSum, reduced.getSum(), Math.abs(expectedSum) * 1e-10);
assertEquals(expectedMin, reduced.getMin(), 0d);
assertEquals(expectedMax, reduced.getMax(), 0d);
// summing squared values, see reason for delta above
Expand Down

0 comments on commit bf2fb21

Please sign in to comment.