Floor `get_rando_addr` port at 1024, not 1000

Ports below 1024 are privileged on linux
(`net.ipv4.ip_unprivileged_port_start = 1024`), so a non-root
`.bind()` on one raises `PermissionError`. The old `1000 +` floor
could roll into the 1000-1023 range and trip flaky `[Errno 13]
Permission denied` registry-listener binds; bump the base to 1024
so every generated port is non-privileged.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
wkt/rm_test_warnings
Gud Boi 2026-06-27 18:54:06 -04:00
parent bc91a1bdfa
commit 3e04968e79
1 changed files with 6 additions and 1 deletions

View File

@ -72,7 +72,12 @@ def get_rando_addr(
# `test_tpt_bind_addrs::bind-subset-reg`), # `test_tpt_bind_addrs::bind-subset-reg`),
# - across parallel pytest sessions, the pid bias # - across parallel pytest sessions, the pid bias
# makes coincident port choices unlikely. # makes coincident port choices unlikely.
port: int = 1000 + ( # NB. floor at 1024, NOT 1000: ports <1024 are PRIVILEGED
# on linux (`net.ipv4.ip_unprivileged_port_start = 1024`),
# so a non-root `.bind()` on one raises `PermissionError`.
# The old `1000 +` floor could roll 1000-1023 -> flaky
# `[Errno 13] Permission denied` registry-listener binds.
port: int = 1024 + (
random.randint(0, 8999) + os.getpid() random.randint(0, 8999) + os.getpid()
) % 9000 ) % 9000
testrun_reg_addr = ( testrun_reg_addr = (