Repository navigation
Conversation
There was a problem hiding this comment.
Auto-approved by the AI review gate on 8f0793a. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
ccoltx
approved these changes
Dec 2, 2026
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
testLoadBalancingPolicyFailoverandtestFailoverinClientIntegrationTestuse111.1.1.1(a China Mobile address) as the node that cannot be reached, and222.2.2.2(a KDDI address) as a second node. The tests expect that the connection to the first node fails with a connection error, so that the client fails over.On a network with a transparent proxy (for example, some VPN setups), the proxy accepts all outgoing TCP connections. The connection to
111.1.1.1:8123opens, but no data comes back. After 30 s the read times out withSocketException/SocketTimeoutException. That error getsERROR_TIMEOUT(159), notERROR_NETWORK(210), so the load balancing policy does not fail over:testLoadBalancingPolicyFailover(unit, all 4 policies, inClickHouseHttpClientTestandApacheHttpConnectionImplTest):expected [222.2.2.2] but found [111.1.1.1]testFailover(integration, both classes):Code: 159. Execution timed outThe fix: both tests now use
127.0.0.1on ports that have no listener. A new helper,findUnusedPorts, gets these ports from the OS (ServerSocket(0)). A connection to such a port is refused at once on all networks (ConnectException→ERROR_NETWORK), and the tests send no traffic to outside addresses.testLoadBalancingPolicyFailoveralso checks the port of the suggested node, because both nodes now have the same host.Each affected test now takes milliseconds, not 30 s. In
clickhouse-http-client, the integration tests take ~85 s, against ~146 s before.Tested with
mvn -pl clickhouse-http-client verify(Docker): 26 unit and 384 integration tests pass.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to test code in
ClientIntegrationTest; production client behavior is unchanged.Overview
Failover-related integration tests no longer use public IPs (
111.1.1.1/222.2.2.2) as unreachable nodes. They now point at127.0.0.1on OS-assigned ports with no listener, via a newfindUnusedPortshelper (ServerSocket(0)bound to the address, sockets held until all ports are chosen, then closed).testLoadBalancingPolicyFailoverbuilds both nodes on localhost with two distinct unused ports, asserts the suggested failover port (not just host), and declaresthrows IOException.testFailoveruses one unused local port for the dead first node, then the real server URI for the second.Connections should fail immediately with connection refused (
ERROR_NETWORK) instead of hanging behind a transparent proxy and surfacing timeouts (ERROR_TIMEOUT), so load-balancing failover behavior is reliable and tests finish in milliseconds rather than ~30s.Reviewed by Cursor Bugbot for commit 8f0793a. Bugbot is set up for automated code reviews on this repo. Configure here.