-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failing StatsSummaryTests.testEqualsAndHashCode tests. #115919
Fix failing StatsSummaryTests.testEqualsAndHashCode tests. #115919
Conversation
Pinging @elastic/es-search (Team:Search) |
randomDoubles(randomIntBetween(0, 20)).forEach(stats1); | ||
randomDoubles(randomIntBetween(0, 20)).forEach(stats2); | ||
randomDoubles(randomIntBetween(1, 1000)).forEach(stats1); | ||
randomDoubles(randomIntBetween(1, 1000)).forEach(stats2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to even keep the random ranges non-overlapping in this case? Or is this overkill because picking the same amount of doubles and the same values is so unlikely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption was indeed that the probability of having an equality with such a combination is lower than winning to the lottery twice the same month ....
Also, I did run the tests with -D tests.iters=1000000
to check the randomization
Closed in favor of #115922 |
Closes #112439
Closes #112511
Description
The failure was due to a high probability (approximately every 400 runs) of adding 0 new items to both accumulators in the following code:
This led to both accumulators being equal when they were not expected to be.