Skip to content

Commit 2fb493c

Browse files
fix(e2e): bind wheel server to IPv4 explicitly on macOS
On macOS, python3 -m http.server without --bind calls getaddrinfo() which returns AF_INET6 first, causing the server to bind to :: (IPv6). Since macOS defaults IPV6_V6ONLY=1, the IPv6 socket does not accept IPv4 connections, so uv connecting to 127.0.0.1 gets ETIMEDOUT. Bind explicitly to 127.0.0.1 on macOS and 0.0.0.0 on Linux (where podman containers need to reach the server via the host's routable IP). Also replaces non-POSIX `which` with `command -v`. Closes: #924 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
1 parent e06f12f commit 2fb493c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

e2e/common.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,20 @@ trap on_exit EXIT SIGINT SIGTERM
6767

6868
start_local_wheel_server() {
6969
local serve_dir="${1:-$OUTDIR/wheels-repo/}"
70-
# Start a web server for the wheels-repo. We remember the PID so we
71-
# can stop it later, and we determine the primary IP of the host
72-
# because podman won't see the server via localhost.
73-
python3 -m http.server --directory "$serve_dir" 9999 &
74-
HTTP_SERVER_PID=$!
75-
if which ip 2>&1 >/dev/null; then
76-
# Linux: need host IP because podman can't reach localhost
70+
# Determine the bind address and the URL that clients will use.
71+
# On Linux podman can't reach localhost, so we bind to 0.0.0.0 and
72+
# advertise the host's routable IP. On macOS there is no network
73+
# isolation; we bind explicitly to 127.0.0.1 to avoid IPv6-only
74+
# sockets that python3 -m http.server may create by default.
75+
if command -v ip >/dev/null 2>&1; then
76+
local BIND_ADDR="0.0.0.0"
7777
IP=$(ip route get 1.1.1.1 | grep 1.1.1.1 | awk '{print $7}')
7878
else
79-
# macOS: no network isolation, localhost works
79+
local BIND_ADDR="127.0.0.1"
8080
IP=127.0.0.1
8181
fi
82+
python3 -m http.server --bind "$BIND_ADDR" --directory "$serve_dir" 9999 &
83+
HTTP_SERVER_PID=$!
8284
export WHEEL_SERVER_URL="http://${IP}:9999/simple"
8385

8486
# Wait for the server to accept connections (up to 15 s).

0 commit comments

Comments
 (0)