From 17c65b4c6cb5106277572cb648f97b79923d1eba Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 5 Apr 2026 21:22:11 -0400 Subject: [PATCH] fix(test): stabilize file interviewer claim-release timing The file interviewer tests were assuming a transient claim file would be observed within a 2ms window, which flaked under full-workspace load. Make the observation wait explicit so nextest remains reliable. --- lib/crates/fabro-interview/src/file.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/crates/fabro-interview/src/file.rs b/lib/crates/fabro-interview/src/file.rs index edb87f164..ec9e63793 100644 --- a/lib/crates/fabro-interview/src/file.rs +++ b/lib/crates/fabro-interview/src/file.rs @@ -216,6 +216,11 @@ mod tests { panic!("{} should exist", path.display()); } + async fn wait_for_claim_observation() { + // Full-workspace test load can delay the poller enough that a 2ms wait is flaky. + time::sleep(Duration::from_millis(25)).await; + } + #[tokio::test] async fn write_request_poll_response() { let dir = tempfile::tempdir().unwrap(); @@ -287,7 +292,7 @@ mod tests { std::fs::write(&claim_path, "12345\n").unwrap(); // Let the poll loop see the claim - time::sleep(TEST_POLL_INTERVAL * 2).await; + wait_for_claim_observation().await; // Simulate attacher departing (deletes claim without writing response) std::fs::remove_file(&claim_path).unwrap(); @@ -323,7 +328,7 @@ mod tests { // Simulate attacher creating then deleting claim std::fs::write(&claim_path, "12345\n").unwrap(); - time::sleep(TEST_POLL_INTERVAL * 2).await; + wait_for_claim_observation().await; std::fs::remove_file(&claim_path).unwrap(); let answer = time::timeout(Duration::from_millis(250), ask_handle) @@ -354,7 +359,7 @@ mod tests { // First attacher creates then releases claim std::fs::write(&claim_path, "12345\n").unwrap(); - time::sleep(TEST_POLL_INTERVAL * 2).await; + wait_for_claim_observation().await; std::fs::remove_file(&claim_path).unwrap(); // Second attacher picks up and answers before reattach window expires