annhchen89 opened a new pull request, #6246:
URL: https://github.com/apache/shenyu/pull/6246

   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   ### What is the purpose of the change
   
   This PR fixes a nondeterministic test in  
`org.apache.shenyu.admin.utils.HttpUtilsTest#buildRequestBuilderForHEADTest`.
   
   The original test performed an exact string comparison against the full URL: 
`http://127.0.0.1/?param-1=123&param-2=456`
   
   However, the test uses a `HashMap` (`formMap`) to build query parameters. 
Since `HashMap` does **not guarantee key iteration order**, the generated query 
string may appear as:
   
   `?param-2=456&param-1=123` or `?param-1=123&param-2=456`
   
   
   This ordering difference causes nondeterministic failures under multiple 
runs or under NonDex, making tests to fail unpredictably despite having 
equivalent data
   
   ## **The Fix**
   
   Instead of asserting the entire URL string (which is order-dependent), the 
test now validates that the URL **contains** all expected key-value pairs: 
`"param-1=123"` and `"param-2=456"`
   
   ---
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   


-- 
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]

Reply via email to