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) <noreply@anthropic.com>
This commit is contained in:
@@ -426,6 +426,8 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second client: attach to the same surface, expect snapshot to contain the marker.
|
// 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 mut s2 = UnixStream::connect(&sock).await.unwrap();
|
||||||
let r = req(&mut s2, 1, Cmd::Attach { surface_id: surface_id.clone() }).await;
|
let r = req(&mut s2, 1, Cmd::Attach { surface_id: surface_id.clone() }).await;
|
||||||
let snap = res_data(&r)["snapshot"].as_str().unwrap();
|
let snap = res_data(&r)["snapshot"].as_str().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user