-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 flaky test by preventing duplicate keys in random mapping fields #9184
Conversation
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
Annoying when one flaky test fix has a failure from another flaky test. :) #9178 |
Gradle Check (Jenkins) Run Completed with:
|
Compatibility status:
|
Latest flaky test failure tracked in #1703... |
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.
@Poojita-Raj I don't think the suggested changes are needed in this case. The collisions are extremely rare and the occasional decrement is still well within (and barely impacts) the random ranges being generated.
If you really think this needs to be engineered more robustly, I'd suggest adding another utility method in OpenSearchTestCase
similar to generateRandomStringArray()
that creates unique strings, and then audit all the tests to see if there are other cases like this one.
For flaky tests, could we also mention how many times the test was run to ensure it's no longer flaky for confidence before we merge it in?
I originally closed the flaky test issue because I could calculate the extremely rare probability of a failure, and asked a similar question here: #6739 (comment)
This was the only failure of this test that I could find in the last 2500 runs using the script, and a search of issues on this repo indicates it was the only case reported ever.
Happy to run this N times to prove no reproduction, but nobody has defined what N should be. Given it's only failed once in 12500 test runs and the probability is at least 1 in 20,000 or so (probably more) I think I'd have to test it at least 30,000 times to make sure it's "fixed". I don't think that's necessary but am willing to write a script to do so.
...t-high-level/src/test/java/org/opensearch/client/indices/GetIndexTemplatesResponseTests.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/index/RandomCreateIndexGenerator.java
Show resolved
Hide resolved
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.
@Poojita-Raj looked at it again and decided to just replace for loops with while checking size, to preserve original size. Realized the aliases were already unique because the index was used as part of the name, so backed out that change.
Should be GTG now. I don't think it's necessary to try to reproduce this again as the cause is well understood, the reproducing duplicate keys still occur with the random seed in the linked issue, and the test doesn't fail.
test/framework/src/main/java/org/opensearch/index/RandomCreateIndexGenerator.java
Show resolved
Hide resolved
Gradle Check (Jenkins) Run Completed with:
|
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
Test failure may have been fixed by #9079 Will rebase |
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
Both |
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Compatibility status:
|
Gradle Check (Jenkins) Run Completed with:
|
This has fallen off the "front page" of PR reviews, so bumping for attention. Minor fix, shouldn't be controversial. @Poojita-Raj (answered your earlier review), @mch2 @andrross @saratvemulapalli @dblock @ryanbogan @owaiskazi19 :-) |
…9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com> (cherry picked from commit e1c40b4) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…9184) (#9406) * Prevent duplicate keys in random mapping fields * Aliases were already unique. Used while loop for indices to keep size --------- (cherry picked from commit e1c40b4) Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…pensearch-project#9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com>
…pensearch-project#9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: Kiran Reddy <kkreddy@amazon.com>
…pensearch-project#9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: Kaushal Kumar <ravi.kaushal97@gmail.com>
…pensearch-project#9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: Ivan Brusic <ivan.brusic@flocksafety.com>
…pensearch-project#9184) * Prevent duplicate keys in random mapping fields Signed-off-by: Daniel Widdis <widdis@gmail.com> * Aliases were already unique. Used while loop for indices to keep size Signed-off-by: Daniel Widdis <widdis@gmail.com> --------- Signed-off-by: Daniel Widdis <widdis@gmail.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Description
Although rare, if you throw random alpha strings together often enough, you'll get a collision.
Related Issues
Fixes #6739
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.