-
Notifications
You must be signed in to change notification settings - Fork 150
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 tests #1204
Fix flaky tests #1204
Conversation
Sometimes if failed when "now + 1 minute" was in tomorrow. For example: java.lang.IllegalArgumentException: Invalid time range: the upper bound time (00:00:47.593917390) is before the lower bound (23:59:47.593917390)
Sometimes if failed when two paralle threads modify field `shuffledLocales`. For example: ``` net.datafaker.integration.FakerRepeatabilityIntegrationTest.shouldCreateUniqueValues -- Time elapsed: 0.890 s <<< ERROR! java.lang.IndexOutOfBoundsException: Index 69 out of bounds for length 69 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) at java.base/java.util.Objects.checkIndex(Objects.java:361) at java.base/java.util.ArrayList.remove(ArrayList.java:504) at net.datafaker.providers.base.Locality.localeStringWithoutReplacement(Locality.java:174) at net.datafaker.providers.base.Locality.localeStringWithoutReplacement(Locality.java:156) ```
it's not needed to remove the element from shuffledLocales and resize the underlying array. It's enough just to keep an index of current element in this list.
PR Summary
|
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.
Thanks for improving it
LGTM
No description provided.