Skip to content

Conversation

@annhchen89
Copy link
Contributor

What does this PR do?

This PR is fixing a nondeterministic test failure in LoadPlanTest.testJson() when running with Nondex.

Problem

Previously, the test used:

assertEquals(expected.replace("'", "\""), json);

This approach directly compared JSON strings. However, JSON object field order is nondeterministic, and NonDex randomizes iteration orders.
As a result, the test failed when field order in the generated JSON differed from the expected literal string, even though both represented the same structure.

Reproduce Test

Run:

mvn edu.illinois:nondex-maven-plugin:2.2.1:nondex -pl core -Dtest=org.apache.accumulo.core.data.LoadPlanTest#testJson

The Fix

Instead of comparing JSON strings directly, the test now parses both expected and actual JSON into JsonNode objects and asserts structural equality. This ensures the comparison is order-independent and validates actual JSON semantics, not textual layout.

@annhchen89 annhchen89 changed the title Make LoadPlanTest#testJson NonDex-safe by comparing JSON structures instead of raw strings Fix non deterministic for LoadPlanTest.testJson() Oct 23, 2025
@annhchen89 annhchen89 changed the title Fix non deterministic for LoadPlanTest.testJson() Fix non deterministic for LoadPlanTest.testJson() Oct 23, 2025
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