Anshul-creator opened a new pull request, #15848:
URL: https://github.com/apache/dubbo/pull/15848

   ## What is the purpose of the change?
   
   This PR stabilizes the test 
`GenericServiceTest.testGenericComplexCompute4FullServiceMetadata`, which was 
exhibiting order-dependent flakiness under randomized execution orders (NonDex).
   
   ## Root Cause
   
   The test compared the returned result string against 
`ComplexObject.toString()` using strict `assertEquals(...)`. However, 
`ComplexObject.toString()` includes a `Map` field `(maps={...})`, and the 
iteration order of `HashMap` entries is not guaranteed. As a result, the 
serialized string could differ only in map-entry ordering (e.g., `{v1_k1=..., 
v1_k2=...}` vs `{v1_k2=..., v1_k1=...}`), causing intermittent assertion 
failures.
   
   ## Changes Made
   
   - Preserved the existing strict `assertEquals(...)` checks for the overall 
result format.
   - Added order-insensitive assertions that validate:
     - the result starts with the expected `"haha###"` / `"haha2###"` prefix, 
and
     - the result contains both expected map entries (`v1_k1=v1_v1` and 
`v1_k2=v1_v2`), regardless of ordering.
   - Kept the rest of the test logic unchanged.
   
   ## Verification
   
   You can try running the following snippet of code from the dubbo repo root, 
on both pre-fix and post-fix code
   
   ```bash
   ./mvnw -q -pl dubbo-compatible \
     edu.illinois:nondex-maven-plugin:2.2.1:nondex \
     -DnondexRuns=100 \
     
-Dtest=org.apache.dubbo.generic.GenericServiceTest#testGenericComplexCompute4FullServiceMetadata
   ```
   
   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-compatible/.nondex` 
directory.
   
   ## Checklist
   - [x] Make sure there is a 
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] 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](https://github.com/apache/dubbo-samples) project.
   - [x] Make sure gitHub actions can pass. [Why the workflow is failing and 
how to fix it?](../CONTRIBUTING.md)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to