From d6443e5a6ea6c3f250f5716a129b7ce4ec8ddad3 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sun, 3 May 2026 19:13:40 +0200 Subject: [PATCH] test: poll for control socket re-creation after SIGHUP The previous assertion ran immediately after a 2s sleep and raced the arbiter's socket re-creation on slow runners (observed flake on FreeBSD 14.2 / Python 3.13). Replace with the wait_for_socket helper already used elsewhere in the file. --- tests/test_control_socket_integration.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_control_socket_integration.py b/tests/test_control_socket_integration.py index 3a1450ef..b55291f1 100644 --- a/tests/test_control_socket_integration.py +++ b/tests/test_control_socket_integration.py @@ -385,8 +385,11 @@ class TestControlSocketAfterReload: response = make_request('127.0.0.1', port) assert b'Hello, World!' in response - # Verify control socket still exists - assert os.path.exists(control_socket), "Control socket disappeared after reload" + # Verify control socket is re-created by the new master. + # The arbiter recreates the socket asynchronously after SIGHUP, so + # poll for it instead of asserting on a fixed sleep. + assert wait_for_socket(control_socket, timeout=10), \ + "Control socket was not re-created after reload" finally: cleanup_gunicorn(proc)