Skip to content

fix(e2e): make mock host ports overridable - #770

Merged
lakhansamani merged 1 commit into
mainfrom
fix/e2e-mock-host-ports
Aug 14, 2026
Merged

fix(e2e): make mock host ports overridable#770
lakhansamani merged 1 commit into
mainfrom
fix/e2e-mock-host-ports

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

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:

Error response from daemon: Ports are not available: exposing port TCP
0.0.0.0:4100 -> 0.0.0.0:0: listen tcp 0.0.0.0:4100: bind: address already in use

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.yml does 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>}:

SMS_SINK_HOST_PORT=4102 make e2e-playground
Variable Default Service
MOCK_OAUTH_HOST_PORT 4000 mock-oauth
MOCK_SAML_IDP_HOST_PORT 4001 mock-saml-idp
SMS_SINK_HOST_PORT 4100 sms-sink
WEBHOOK_SINK_HOST_PORT 4200 webhook-sink
CIMD_CLIENT_HOST_PORT 4300 cimd-client

Fixed 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 to curl a sink.

Verified

$ docker compose -f e2e-playground/docker-compose.yml config | grep published
  4000  4001  4100  4200  4300          # defaults unchanged

$ SMS_SINK_HOST_PORT=4102 docker compose ... config | grep published
  4000  4001  4102  4200  4300          # only the overridden one moves

The suites themselves were verified green on this stack in the same session: Playwright 98 passed, Go SDK e2e 14 passed.

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.
@lakhansamani
lakhansamani merged commit 337e565 into main Aug 14, 2026
3 checks passed
@lakhansamani
lakhansamani deleted the fix/e2e-mock-host-ports branch August 14, 2026 13:12
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