Archonic944 opened a new pull request, #16153:
URL: https://github.com/apache/dubbo/pull/16153

   ## What is the purpose of the change?
   
   The purpose of this change is to modify the test 
org.apache.dubbo.rpc.protocol.dubbo.status.ThreadPoolStatusCheckerTest so that 
it consistently succeeds. 
   
   ## Why does the test fail?
   
   The test's implementation compares status message output (from a 
`ThreadPoolStatusChecker`) against an expected string. The expected string 
contains an exact order, but the `ThreadPoolStatusChecker` in reality iterates 
over a `Map.entrySet()` to produce its static string. Therefore, iteration 
order is not guaranteed. When the map returns a different order than usual, 
which is valid under Java specifications, the test fails.
   
   ## How to reproduce the test failure
   
   Run the test with 
[NonDex](https://github.com/TestingResearchIllinois/NonDex) to shuffle 
collection iteration order:
   ```bash
     mvn edu.illinois:nondex-maven-plugin:2.2.1:nondex \
       -pl dubbo-rpc/dubbo-rpc-dubbo \
       
-Dtest=org.apache.dubbo.rpc.protocol.dubbo.status.ThreadPoolStatusCheckerTest#test
 \
       -DnondexRuns=10
   ```
   
   ## Expected results
   
   The test expects 
   ```
   Pool status:WARN, max:1, core:1, largest:0, active:0, task:0, service port: 
8888;
   Pool status:OK, max:10, core:10, largest:0, active:0, task:0, service port: 
8889
   ``` 
   to be returned from `ThreadPoolStatusChecker#check#getMessage`.
   
   ## Actual results
   
   When the collection order is shuffled, the test receives 
   ```
   Pool status:OK, max:10, core:10, largest:0, active:0, task:0, service port: 
8889;
   Pool status:WARN, max:1, core:1, largest:0, active:0, task:0, service port: 
8888
   ```
   
   ## Description of Fix
   
   Instead of comparing the status message to an exact string:
   
   1. Split the status message by `;`. Ensure that there are only two items in 
the returned array. 
   2. Ensure that the status message (as a whole) contains both expected 
pieces, regardless of order.
   
   ## 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