XiaoyangCai360 opened a new pull request, #7858:
URL: https://github.com/apache/incubator-seata/pull/7858
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Please make sure you have read and understood the contributing
guidelines -->
- [x] I have read the
[CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md)
guidelines.
- [x] I have registered the PR
[changes](https://github.com/apache/incubator-seata/tree/2.x/changes).
### Ⅰ. Describe what this PR did
This PR fixes test flakiness in
`org.apache.seata.integration.http.HttpTest.convertParamOfJsonStringTest`.
The test was intermittently failing because it compared the `toString()`
output
of a `Map`, which depends on the iteration order of the underlying `HashMap`.
Since `HashMap` does not guarantee a deterministic key order, different JVM
or
NonDex execution orders could produce logically equivalent but differently
ordered string representations (e.g. `{age=15, name=zhangsan}` vs
`{name=zhangsan, age=15}`), causing false negatives.
The fix updates the test to perform **order-independent map comparisons**
by asserting map equality directly, instead of relying on `toString()`
output.
**This change is test-only and does not modify any production code.**
### Ⅱ. Does this pull request fix one issue?
<!-- If applicable, add "fixes #xxx" below -->
### Ⅲ. Why don't you add test cases (unit test/integration test)?
This PR focuses on correcting an existing flaky unit test by making its
assertions deterministic and order-independent. No new functionality is
introduced.
### Ⅳ. Describe how to verify it
The fix can be verified by repeatedly running the affected test under a
non-deterministic execution environment such as
[NonDex](https://github.com/TestingResearchIllinois/NonDex).
Example command:
```bash
mvn -pl integration/http \
-am edu.illinois:nondex-maven-plugin:2.1.7:nondex \
-Dtest=org.apache.seata.integration.http.HttpTest#convertParamOfJsonStringTest \
-DnondexRuns=10 \
-DfailIfNoTests=false
```
### Ⅴ. Special notes for reviews
- Test-only change in the `seata-http` module.
- No production code modified.
- Improves CI stability under non-deterministic execution orders.
--
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]