You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TestBindPairLeavesReservedBlock fails on Windows with reserved TCP port ranges #254
TestBindPairLeavesReservedBlock fails on Windows hosts that have reserved TCP port ranges (Hyper-V or WinNAT). It failed in 5 of 6 runs on one such host. The product code is fine. The test helper picks its "random" ports in a way that the #204 fix deliberately avoids.
Where
internal/dnsserver/bindpair_test.go:39-48: the pick helper takes OS-assigned ephemeral UDP ports, which are sequential (for example 49709, 50206)
On the affected host, netsh int ipv4 show excludedportrange protocol=tcp shows 49672-50384 reserved, and the test's ports fall inside it. When the real 4th TCP bind is refused, the test fails with either no free UDP+TCP port pair or UDP binds [...9 entries], want 4. Product code uses randomPort (20000-59999).
Impact
go test ./... fails locally for Windows contributors who have Hyper-V or WSL port reservations.
Steps to reproduce
On such a host: go test ./internal/dnsserver/ -run TestBindPair -count=5
Suggested fix
Have pick draw ports from randomPort, retrying until the UDP port is free. Relax the assertion to: the first attempt is :0, the next attempts are explicit ports, and the final UDP and TCP pair share one port.
Acceptance criteria
The test passes on a host with reserved TCP ranges in the ephemeral block.
Fixed in 2ff3029: the test's pick draws from randomPort and keeps a port free for both UDP and TCP; the bind-count assertion is now 'at least 4'. Verified with go test -run TestBindPair -count=20 ./internal/dnsserver/ on the same Windows host that failed 5/6 before: 20/20 pass.
Activity
TMHSDigital commentedon Nov 14, 2026
Fixed in 2ff3029: the test's pick draws from randomPort and keeps a port free for both UDP and TCP; the bind-count assertion is now 'at least 4'. Verified with go test -run TestBindPair -count=20 ./internal/dnsserver/ on the same Windows host that failed 5/6 before: 20/20 pass.