Skip to content

Run the remaining mock credential servers on unused ports - #70

Merged
quinnj-bot[bot] merged 2 commits into
mainfrom
claude/mock-server-ports
Oct 29, 2026
Merged

quinnj-bot[bot] merged 2 commits into
mainfrom
claude/mock-server-ports

Conversation

@quinnj-bot

@quinnj-bot quinnj-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The ECS, EC2, AzureVM and GCP token/STS/impersonation tests started mock servers on fixed ports 50396-50404 (CloudBaseTest's defaults plus two overrides). Those ports are inside Linux's ephemeral range (32768-60999), so any socket on the runner, including this test run's own client connections, can hold one, and the mock then fails with bind: address already in use. That failed main three times in about 30 runs: Sep 23 and Oct 22 on port 50400 (moved to an OS-assigned port in #64), and the v2.2.0 bump today on port 50404 (run).

Change (tests only):

  • ECS, EC2 and AzureVM tests serve CloudBaseTest's responses from servers on OS-assigned ports, as Run the GCP Metadata test server on an OS-assigned port #64 did for GCP Metadata. CloudBaseTest's with helpers for these have no port option.
  • GCP token, STS and impersonation mocks get an unused port from freeport(): the listenany pattern the file already uses for its other mock servers, but probing 127.0.0.1 (the address the mocks bind) from a start below 32768, outside the Linux and macOS ephemeral ranges, so no outgoing connection can take the port before the mock binds it. The impersonation port is picked while the STS mock is listening, so the two can't get the same port.
  • No test in the suite uses a fixed port anymore.

Verification (Julia 1.13.3, macOS), with a separate process listening on all of 127.0.0.1:50396-50404:

  • CloudBaseTest's mocks fail as on CI: http address already in use: 127.0.0.1:50404.
  • This branch: full suite passes (Testing CloudBase tests passed), including all 7 changed testsets.
  • main under the same conditions: AWS ECS Task errors with http address already in use: 127.0.0.1:50396 and the run stops there.

Self-review: handlers match CloudBaseTest's routes and responses (AzureVM's header/query checks return 400 instead of tripping an @assert); withenv restores AWS_CONTAINER_CREDENTIALS_RELATIVE_URI; every server closes in finally.

Follow-up idea, not in this PR: CloudBaseTest's ECS/EC2/AzureVM/GCP* with helpers still default to fixed ports. Accepting port=0 and handing the bound port to the callback would let tests use them again without the fixed-port risk.

🤖 Generated with Claude Code

quinnj and others added 2 commits October 29, 2026 16:42
The ECS, EC2, AzureVM and GCP token/STS/impersonation tests started their
mock servers on fixed ports 50396-50404. Those ports are inside Linux's
ephemeral range, so any socket on a CI runner, including this test run's
own client connections, can hold one, and the mock then fails with
"bind: address already in use". That failed main on Sep 23 and Oct 22
(port 50400, moved to an OS-assigned port in #64) and on the v2.2.0 bump
(port 50404).

The ECS, EC2 and AzureVM tests now serve CloudBaseTest's responses from
servers on OS-assigned ports, and the GCP mocks get an unused port from
freeport().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quinnj-bot
quinnj-bot Bot merged commit 0bd5572 into main Oct 29, 2026
5 checks passed
@quinnj-bot
quinnj-bot Bot deleted the claude/mock-server-ports branch October 29, 2026 22:59
@quinnj-bot quinnj-bot Bot mentioned this pull request Nov 1, 2026
quinnj referenced this pull request Nov 1, 2026
Co-authored-by: Jacob Quinn <quinn.jacobd@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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