fix(lease-broker): wait_ready() polls real connect-readiness not socket-file existence (flaky CI race) (#898)
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful

Co-authored-by: jason.woltje <jason@diversecanvas.com>
Co-committed-by: jason.woltje <jason@diversecanvas.com>
This commit was merged in pull request #898.
This commit is contained in:
2026-07-25 22:10:15 +00:00
committed by Mos
parent 2483dada33
commit 79c8647fd9

View File

@@ -51,8 +51,13 @@ def request(socket_path: Path, value: dict[str, object]) -> dict[str, object]:
def wait_ready(process: subprocess.Popen[str], socket_path: Path) -> None: def wait_ready(process: subprocess.Popen[str], socket_path: Path) -> None:
deadline = time.monotonic() + 5.0 deadline = time.monotonic() + 5.0
while time.monotonic() < deadline: while time.monotonic() < deadline:
if socket_path.exists(): try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as probe:
probe.settimeout(0.25)
probe.connect(str(socket_path))
return return
except (ConnectionRefusedError, FileNotFoundError):
pass
if process.poll() is not None: if process.poll() is not None:
output = process.stdout.read() if process.stdout is not None else "" output = process.stdout.read() if process.stdout is not None else ""
raise RuntimeError(f"daemon exited before READY: {output}") raise RuntimeError(f"daemon exited before READY: {output}")