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.
This commit is contained in:
Benoit Chesneau 2026-05-03 19:13:40 +02:00
parent 8e25cb2400
commit d6443e5a6e

View File

@ -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)