From a56d8d0feac6beae3fc58c706d9e9d6f44bce301 Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Tue, 9 Jun 2026 20:16:18 +0700 Subject: [PATCH] test(daemon): harden reattach test with pre-connect socket guard Add wait_for_socket before second client connect to handle scheduling jitter when tests run in parallel under cargo test --workspace. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/spaceshd/src/server.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/spaceshd/src/server.rs b/crates/spaceshd/src/server.rs index 1c33c78..608678a 100644 --- a/crates/spaceshd/src/server.rs +++ b/crates/spaceshd/src/server.rs @@ -426,6 +426,8 @@ mod tests { } // Second client: attach to the same surface, expect snapshot to contain the marker. + // Re-verify the socket is still up before connecting (handles any scheduling jitter). + wait_for_socket(&sock).await; let mut s2 = UnixStream::connect(&sock).await.unwrap(); let r = req(&mut s2, 1, Cmd::Attach { surface_id: surface_id.clone() }).await; let snap = res_data(&r)["snapshot"].as_str().unwrap();