Skip to content

Use dynamic ports for test servers#3138

Merged
kblok merged 3 commits intomasterfrom
dynamic-test-server-ports
Feb 16, 2026
Merged

Use dynamic ports for test servers#3138
kblok merged 3 commits intomasterfrom
dynamic-test-server-ports

Conversation

@kblok
Copy link
Member

@kblok kblok commented Feb 16, 2026

Summary

  • Replace hardcoded test server ports (7081/7082) with OS-assigned ephemeral ports (port 0) so multiple worktrees/CI jobs can run tests simultaneously without port conflicts
  • SimpleServer now exposes Port, Prefix, and IpPrefix properties read from Kestrel after startup
  • TestConstants fields converted from const/static readonly to static properties initialized at test setup time

Test plan

  • dotnet build compiles with zero test file changes (only 1 test file needed a constvar fix)
  • Smoke test passes: PageGotoTests.ShouldWork (10 tests)
  • Port-dependent test passes: NetworkEventTests.ResponseRemoteAddressShouldSupportRedirects
  • Run full test suite
  • Run two test processes simultaneously to confirm no port collision

🤖 Generated with Claude Code

kblok and others added 3 commits February 16, 2026 15:56
Replace hardcoded ports 7081/7082 with OS-assigned ephemeral ports (port 0)
so multiple worktrees can run tests simultaneously without conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The dynamic port allocation can assign ports with 5 digits, but the
test regex patterns only matched 4-digit ports (\d{4}), causing
test failures on CI.

Co-Authored-By: Claude Opus 4.6 <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