fix(e2e): make mock host ports overridable - #770
Merged
Conversation
The e2e stack published five fixed host ports (4000, 4001, 4100, 4200,
4300). Any of them being taken on the developer's machine fails the whole
suite at startup, with no way to change it short of editing the compose
file:
Error response from daemon: Ports are not available: exposing port TCP
0.0.0.0:4100 ... bind: address already in use
docker-compose.override.yml is not a usable escape hatch either, because
both make targets pass an explicit -f, which suppresses automatic override
discovery.
Each is now ${SERVICE_HOST_PORT:-<default>}. Defaults are unchanged, and
nothing inside the stack is affected: services address each other over the
compose network (http://sms-sink:4100), never via the host.
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.
Why
The e2e stack publishes five fixed host ports — 4000, 4001, 4100, 4200, 4300. If any is in use on the developer's machine, the entire suite dies at startup:
Hit this for real while running
make e2e-playground— an unrelated local process held 4100.There was no way out short of editing the committed compose file.
docker-compose.override.ymldoes not work here: both make targets pass an explicit-f, which suppresses Compose's automatic override discovery — so the documented escape hatch silently does nothing.What
Each published port becomes
${SERVICE_HOST_PORT:-<default>}:MOCK_OAUTH_HOST_PORTMOCK_SAML_IDP_HOST_PORTSMS_SINK_HOST_PORTWEBHOOK_SINK_HOST_PORTCIMD_CLIENT_HOST_PORTFixed all five rather than only
sms-sink: it is one defect with five instances, and fixing the one port that happened to collide today would leave the next developer to rediscover it on 4000.Why this is safe
Nothing inside the stack uses the host publication. Every internal reference is over the compose network (
SMS_SINK_BASE_URL: http://sms-sink:4100), the mock listens on its container port unchanged, and both the Playwright and Go SDK runners execute inside that network. The host mapping exists only for a human wanting tocurla sink.Verified
The suites themselves were verified green on this stack in the same session: Playwright 98 passed, Go SDK e2e 14 passed.