Repository navigation
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
|
snuyanzin
left a comment
There was a problem hiding this comment.
Thanks for improving it
LGTM
No description provided.