Repository navigation
Publish test containers on host ports below the ephemeral range - #1920
Draft
realtonyyoung wants to merge 7 commits into
Draft
realtonyyoung wants to merge 7 commits into
realtonyyoung wants to merge 7 commits into
Conversation
A port-0 bind and Docker's own choice both draw from 32768-60999, which a loaded runner's sockets fill. The resource reaper's port setting is marked obsolete but still read, and its test fails if an upgrade stops honouring it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Testcontainers parses an image string with a regex whose 5-second timeout a starved runner can exceed; only new DockerImage(repository, tag: ...) skips the parse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two processes picking the same port get Docker's own "port is already allocated", not the kernel's "address already in use". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tement Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A quote inside a comment opened a string that hid the code after it, and a lambda body's semicolon cut a builder chain short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
AI-4381 (no GitHub issue)
What & why
The integration tests' WorkOS emulator took its host port from a port-0 bind, and Testcontainers' resource reaper took Docker's choice. Both draw from 32768–60999, the Linux ephemeral range a loaded runner's outbound sockets and TIME_WAITs crowd, so a start can fail with
address already in usehowever often it is retried there. Every container now publishes on a port from 20000–32767 that is checked free on IPv4 and IPv6 first, picked by a process-wide cursor so two starts in one process never race for the same one, and a clash with another process, in either of Docker's two wordings, rebuilds the container on the next free port. The emulator's image is also built fromnew DockerImage(repository, tag:), since Testcontainers parses an image string with a regex whose 5-second timeout a starved runner can exceed. This is the twin of kurrent-io/kcap-server#2654Where to look
ContainerHostPortsin the integration project. The reaper's port goes throughTestcontainersSettings.ResourceReaperPublicHostPort, which is marked obsolete but still read by Testcontainers 4.16; its test fails if an upgrade stops honouring it. Two unit guards refuse anyWithPortBindingnot fed by the picker and any container built from an image stringVerification
Expected to not contain 22575Expected to be less than 32768 but received 53312… but received 53386WorkOSEmulator.cscollection contains items: [test/Capacitor.Cli.Tests.Integration/WorkOSEmulator.cs]Expected to not be equal … but received 30834Expected to be equal to True but received False"ghcr.io/workos/emulate:0.15.0"collection contains items: [test/Capacitor.Cli.Tests.Integration/WorkOSEmulator.cs]WorkOSEmulatorSignInTests(login, refresh and restart against the emulator) passes on the new port🤖 Generated with Claude Code