cloudbase-ai opened a new pull request, #7891: URL: https://github.com/apache/shenyu/pull/7891
Refs #6281. This is a scoped SDK test-stability improvement; it does not claim to resolve all historical CI failures tracked by that issue. `HttpShenyuSdkClientTest.testShenyuHttpClient()` creates a `CALLS_REAL_METHODS` mock and evaluates `doRequest()` inside `when(...)`. Evaluating that stub performs a real HTTPS request to `shenyu.apache.org`, before any assertions, so the test depends on external DNS/network/website availability. Replace that request with a real `HttpShenyuSdkClient` talking to a JDK `HttpServer` bound to `127.0.0.1` on an ephemeral port. Assert the GET method, path/query, repeated request-header values, controlled response status, UTF-8 response body, response header, and original request reference. Close the client and server in nested `finally` blocks and bound the test duration. The change is limited to one test file and adds no dependency or production-code change. Validation: - The original test passed with normal network access in this run. With the test JVM's name resolution limited to a temporary localhost-only hosts file, the original test failed with `UnknownHostException` for `shenyu.apache.org`. - Under that same restricted resolver, the updated `HttpShenyuSdkClientTest` passes all 8 tests. The restriction is process-local: no system hosts file or network configuration was changed. - `./mvnw -B -ntp -pl shenyu-sdk/shenyu-sdk-httpclient -am test -Dtest=HttpShenyuSdkClientTest -Dsurefire.failIfNoSpecifiedTests=false -DargLine=-Djdk.net.hosts.file=/tmp/shenyu-6281-loopback-hosts -Djacoco.skip=true -Dmaven.javadoc.skip=true` passed. The temporary hosts file contains only `127.0.0.1 localhost` and `::1 localhost`. - A JUnitCore runner repeated the updated request test 10 times in one JVM with the localhost-only resolver: 10 passes, no failures. No sleeps or retry-on-failure were added. - `./mvnw -B -ntp -pl shenyu-sdk/shenyu-sdk-core,shenyu-sdk/shenyu-sdk-httpclient,shenyu-sdk/shenyu-sdk-okhttp,shenyu-sdk/shenyu-sdk-spring,shenyu-sdk/shenyu-sdk-feign -am verify -Dmaven.javadoc.skip=true -Djacoco.skip=true` passed: 704 tests reported, 0 failures/errors, 11 skips across the selected SDK modules and dependencies; Checkstyle and RAT passed. - `git diff --check` passed. Docker E2E and a deployed gateway integration environment were not run for this test-only change. -- 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]
