Skip to content

Fix flaky test in AtlasJanusGraphIndexClientTest#testGetTopTermsRandom4#462

Open
bee0511 wants to merge 1 commit intoapache:masterfrom
bee0511:fix-flaky
Open

Fix flaky test in AtlasJanusGraphIndexClientTest#testGetTopTermsRandom4#462
bee0511 wants to merge 1 commit intoapache:masterfrom
bee0511:fix-flaky

Conversation

@bee0511
Copy link

@bee0511 bee0511 commented Sep 28, 2025

What changes were proposed in this pull request?

The test AtlasJanusGraphIndexClientTest#testGetTopTermsRandom4 failed intermittently because HashMap iteration order is non-deterministic.
Changed generateTerms(...) to use LinkedHashMap so iteration order is consistent.

This is a test-only change.

How was this patch tested?

  • Reproduced flaky failures with NonDex, a tool that systematically perturbs iteration order to expose order-dependent bugs.

  • Example command:

    mvn -pl graphdb/janus edu.illinois:nondex-maven-plugin:2.1.7:nondex \
      -Dtest=org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest#testGetTopTermsRandom4 \
      -Drat.skip
  • Before fix:

[INFO] Running org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.806 s <<< FAILURE! - in org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest
[ERROR] org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest.testGetTopTermsRandom4  Time elapsed: 0.423 s  <<< FAILURE!
java.lang.AssertionError: expected [8] but found [7]
        at org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest.assertOrder(AtlasJanusGraphIndexClientTest.java:143)
        at org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphIndexClientTest.testGetTopTermsRandom4(AtlasJanusGraphIndexClientTest.java:99)
  • After fix: test passes consistently under repeated NonDex runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant