Skip to content

test(cli): fix flaky proxy integration test (port allocation on main CI)#56

Merged
alex-clickhouse merged 1 commit into
mainfrom
fix-proxy-integration-port-flakiness
Jun 15, 2026
Merged

test(cli): fix flaky proxy integration test (port allocation on main CI)#56
alex-clickhouse merged 1 commit into
mainfrom
fix-proxy-integration-port-flakiness

Conversation

@alex-clickhouse

Copy link
Copy Markdown
Collaborator

The proxy integration tests reserved OS-assigned free ports (the ephemeral range, 32768+) and exposed them to containers. Docker publishes container ports from that same range, so testcontainers' own mappings/forwarder could claim a just-released port, and the proxy then failed to bind with EADDRINUSE. With no fast-fail path the listening wait hung 45s and the rejected proxyCommand promise surfaced as an unhandled rejection — the failure seen on the post-merge main run.

  • Use fixed candidate ports below the ephemeral range (14100+), which the OS won't auto-assign and Docker won't publish to, so they don't race with container port mappings.
  • Detect a bind failure immediately (capture the early rejection) and retry on the next candidate port instead of waiting out the timeout; this also prevents the unhandled rejection.
  • Lower the listening-wait timeout to 20s now that bind failures fail fast.

The proxy integration tests reserved OS-assigned free ports (the ephemeral
range, 32768+) and exposed them to containers. Docker publishes container
ports from that same range, so testcontainers' own mappings/forwarder could
claim a just-released port, and the proxy then failed to bind with
EADDRINUSE. With no fast-fail path the listening wait hung 45s and the
rejected proxyCommand promise surfaced as an unhandled rejection — the
failure seen on the post-merge main run.

- Use fixed candidate ports below the ephemeral range (14100+), which the OS
  won't auto-assign and Docker won't publish to, so they don't race with
  container port mappings.
- Detect a bind failure immediately (capture the early rejection) and retry
  on the next candidate port instead of waiting out the timeout; this also
  prevents the unhandled rejection.
- Lower the listening-wait timeout to 20s now that bind failures fail fast.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alex-clickhouse alex-clickhouse merged commit b88f02c into main Jun 15, 2026
1 check passed
@alex-clickhouse alex-clickhouse deleted the fix-proxy-integration-port-flakiness branch June 15, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant