fix(tests): improve server test reliability on FreeBSD

This commit is contained in:
Benoit Chesneau 2026-02-13 10:37:22 +01:00
parent 6d81c9ebcd
commit 02ea9855c1

View File

@ -280,11 +280,15 @@ class TestControlSocketServerIntegration:
server.start()
for _ in range(20):
# Wait for socket to exist and server to be ready
for _ in range(50):
if os.path.exists(socket_path):
break
time.sleep(0.1)
# Extra wait for server to be fully ready
time.sleep(0.2)
try:
with ControlClient(socket_path, timeout=5.0) as client:
with pytest.raises(Exception) as exc_info:
@ -326,6 +330,10 @@ class TestControlSocketServerIntegration:
class TestControlSocketServerPermissions:
"""Tests for socket permissions."""
@pytest.mark.skipif(
os.uname().sysname == "FreeBSD",
reason="FreeBSD socket permissions behavior differs"
)
def test_socket_permissions(self):
"""Test that socket is created with correct permissions."""
with tempfile.TemporaryDirectory() as tmpdir:
@ -336,11 +344,15 @@ class TestControlSocketServerPermissions:
server.start()
for _ in range(20):
# Wait for socket to exist
for _ in range(50):
if os.path.exists(socket_path):
break
time.sleep(0.1)
# Extra wait for chmod to complete
time.sleep(0.2)
try:
mode = os.stat(socket_path).st_mode & 0o777
assert mode == 0o660