Fix Six Flaky Tests in /gremlin-core#2887
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.7-dev #2887 +/- ##
=============================================
+ Coverage 76.14% 76.43% +0.28%
- Complexity 13152 13226 +74
=============================================
Files 1084 1060 -24
Lines 65160 61491 -3669
Branches 7285 7336 +51
=============================================
- Hits 49616 46999 -2617
+ Misses 12839 11972 -867
+ Partials 2705 2520 -185 ☔ View full report in Codecov by Sentry. |
Cole-Greer
left a comment
There was a problem hiding this comment.
Hi @qz0610, thanks for opening this PR. Overall the change looks good to me. Just a quick note, the 3.6-dev branch has not been reopened following the recent release of 3.6.8, as that will likely be the final release in the 3.6.x line. This topic was raised on the devlist last week (https://lists.apache.org/thread/ysc1ov4l3x3v3nyjr3b7z05tml7s7o46).
Would you mind re-targeting this PR to 3.7-dev?
...kerpop/gremlin/process/traversal/strategy/verification/ReservedKeysVerificationStrategy.java
Outdated
Show resolved
Hide resolved
…s/traversal/strategy/verification/ReservedKeysVerificationStrategy.java Co-authored-by: Cole Greer <112986082+Cole-Greer@users.noreply.github.com>
|
Hi @Cole-Greer, thank you for the review and feedback. The PR is now re-targeted to 3.7-dev. Please let me know if there's anything else I need to adjust. |
|
VOTE +1 |
Description
Six flaky tests in gremlin-core were found using nondex:
org.apache.tinkerpop.gremlin.process.traversal.translator.DotNetTranslatorTest.shouldTranslateStrategiesorg.apache.tinkerpop.gremlin.process.traversal.translator.JavascriptTranslatorTest.shouldTranslateStrategiesorg.apache.tinkerpop.gremlin.process.traversal.translator.GolangTranslatorTest.shouldTranslateStrategiesorg.apache.tinkerpop.gremlin.process.traversal.translator.PythonTranslatorTest.shouldTranslateStrategiesorg.apache.tinkerpop.gremlin.process.traversal.translator.GroovyTranslatorTest.shouldTranslateStrategiesorg.apache.tinkerpop.gremlin.language.grammar.TraversalStrategyVisitorTest.testTraversalStrategyThe flakiness can be reproduced by running:
flaky test failures:
The five
shouldTranslateStrategiestests have the same root cause for flakiness: these tests assume the map returned bygetConfiguration()insubgraphStrategyclass stores elements in deterministic order, that may result in inconsistent test results. Similarly,TraversalStrategyVisitorTest.testTraversalStrategyassumes the deterministic order of keys stored in HashSet.Proposed Fix
This pr proposes a simple fix by storing the configuration of subgraphStrategy in LinkedHashMap, and storing the reserved keys in LinkedHashSet. After this fix, all the six tests pass consistently. Alternatively, if maintaining Hashmap and Hashset is preferred, I could try to modify the test assertions using regular expression matches or custom comparators.