Skip to content

test: avoid released ports in connection failure fixtures - #5949

Open
TaylorMutch wants to merge 2 commits into
mainfrom
test/4569-port-races/TaylorMutch
Open

TaylorMutch wants to merge 2 commits into
mainfrom
test/4569-port-races/TaylorMutch

Conversation

@TaylorMutch

@TaylorMutch TaylorMutch commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Avoid releasing ephemeral ports in connection-failure tests, where a parallel listener can turn an expected failure into an unrelated protocol response. Use destination 127.0.0.1:0 for generic connection errors, retain silent listeners for PostgreSQL acquisition timeouts, and retain a bound socket for the Linux connection-refusal test.

Related Issue

Closes #4569. The audit comment records additional potential server/subprocess handoff races.

Changes

  • Use port zero in peer-routing metrics, OTLP exporters, GitHub token transport, Vault proxy, testkit program, and sandbox performance tests. Binding port zero allocates a different port, so a listener cannot claim this destination. Tests assert the transport failure rather than an OS-specific error kind.
  • Keep PostgreSQL fixtures' silent listeners bound through startup, mutation-lock, and pool-budget checks.
  • Preserve exact connection-refusal coverage on Linux with a bound, non-listening socket. The test also checks that a normal Tokio listener with address reuse enabled cannot claim it.
  • Let the readiness bind test allocate its port on its actual listener and document test-port guidance.

Testing

  • Focused server, supervisor, credential-issuer, and Vault tests pass on macOS ARM64.
  • Revised PostgreSQL startup test passes 12 runs across four concurrent processes.
  • All 14 testkit program checks pass.
  • Clippy with -D warnings passes for server, supervisor, credential-issuer, and Vault libraries/tests, plus testkit tests.
  • Root and testkit formatting checks, Markdown lint, and diff whitespace checks pass.
  • Cargo's credential-issuer no-default-features graph excludes core telemetry.

The Linux-only refusal regression and sandbox performance-harness test were not run locally. Windows runtime behavior was not validated locally.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 24, 2026
@TaylorMutch TaylorMutch added area:build CI/CD workflows, releases, build targets, packaging, and artifact publication. topic:testing Unit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure. labels Nov 24, 2026
@TaylorMutch TaylorMutch changed the title test: reserve refusal endpoints across parallel tests test: avoid released ports in connection failure fixtures Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build CI/CD workflows, releases, build targets, packaging, and artifact publication. state:accepted A maintainer decided OpenShell should pursue this issue topic:testing Unit, integration, regression, conformance, E2E tests, coverage, flakes, and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(cli): sandbox forward tests flake when another test claims the released port

1 participant