fix(test): daemon 503 test binds an OS-assigned port, not old-port+1

windows-free-tests flaked on this PR: the tunnel-less restart bound
daemon.loopbackPort + 1 — a fixed neighbor of the OS-assigned ephemeral
port — and died with 'Is port 55738 in use?' whenever another shard or a
TIME_WAIT socket held it; the file-level retry re-rolled the same dice.
Every other startDaemon in the file already uses loopbackPort: 0 and the
assertion reads d2.loopbackPort, so nothing needs a predictable number.
21/21 pass locally.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-09-01 22:59:46 +00:00
co-authored by Claude Fable 5
parent 5349bd9066
commit 5a48670b65
@@ -466,7 +466,12 @@ describe('daemon — loopback listener', () => {
await daemon.close();
pidPath = join(workDir, 'daemon-2.pid');
const d2 = await startDaemon({
loopbackPort: daemon.loopbackPort + 1,
// OS-assigned like every other start in this file — the old
// `daemon.loopbackPort + 1` bound a fixed neighbor port and flaked
// whenever another shard/TIME_WAIT socket held it (windows-free-tests:
// "Is port 55738 in use?"). The fetch below reads d2.loopbackPort, so
// nothing needs a predictable number.
loopbackPort: 0,
tailnetEnabled: false,
pidfilePath: pidPath,
tunnelProvider: async () => null,