test: remove external network dependency from HttpClientUtilTest by codingkiddo · Pull Request #8099 · apache/incubator-seata (original) (raw)
What changed
Replaced the external HTTP calls in HttpClientUtilTest#testHttpSendRes with a local in-process HTTP server bound to 127.0.0.1 on a random port.
Why
The previous test depended on an external network endpoint, which could make the unit test flaky in local or CI environments when DNS, proxy, firewall, or network connectivity is unavailable or slow.
Using a local HTTP server keeps the test deterministic while still exercising the existing HttpClientUtil GET and POST request paths.
Validation
./mvnw -pl common clean test -Dtest=HttpClientUtilTest#testHttpSendRes
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 BUILD SUCCESS