Skip to content

Conversation

@Anshul-creator
Copy link

@Anshul-creator Anshul-creator commented Oct 29, 2025

What is the purpose of the change?

This PR stabilizes JsonUtilsTest.consistentTest, which previously exhibited nondeterministic failures under random execution orders

Root Cause

The issue stemmed from comparing raw JSON strings produced by different JSON frameworks (fastjson2, fastjson, gson, jackson). These frameworks may serialize map fields in different key orders, leading to order-dependent failures.

Changes Made

  • Updated assertions to compare JSON structures instead of raw strings using:

    new ObjectMapper().readTree(json)

    This ensures comparisons are semantically equivalent and order-insensitive.

  • Added throws Exception to the test method to handle Jackson’s checked exceptions.

Verification

You can try running the following snippet of code from the dubbo repo root, on both pre-fix and post-fix code

./mvnw -pl dubbo-common edu.illinois:nondex-maven-plugin:2.2.1:nondex \
  -DnondexRuns=10 \
  -Dtest=org.apache.dubbo.common.utils.JsonUtilsTest#consistentTest

The test should fail intermittently on the pre-fix version, but pass consistently across all seeds on the post-fix version.
NonDex run logs will be available under the dubbo-common/.nondex directory.

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.74%. Comparing base (aed93d5) to head (f55224c).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15746      +/-   ##
============================================
- Coverage     60.77%   60.74%   -0.03%     
- Complexity       15    11724   +11709     
============================================
  Files          1938     1938              
  Lines         88627    88627              
  Branches      13381    13380       -1     
============================================
- Hits          53863    53840      -23     
- Misses        29238    29253      +15     
- Partials       5526     5534       +8     
Flag Coverage Δ
integration-tests-java21 32.31% <ø> (-0.06%) ⬇️
integration-tests-java8 32.53% <ø> (-0.01%) ⬇️
samples-tests-java21 32.11% <ø> (+<0.01%) ⬆️
samples-tests-java8 29.82% <ø> (-0.03%) ⬇️
unit-tests-java11 59.02% <ø> (-0.04%) ⬇️
unit-tests-java17 58.50% <ø> (-0.05%) ⬇️
unit-tests-java21 58.50% <ø> (-0.05%) ⬇️
unit-tests-java8 59.01% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Anshul-creator Anshul-creator marked this pull request as ready for review October 29, 2025 05:04
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.

2 participants