From 86d06fd44f26fef6f3d8673365de133189331cec Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Mon, 16 Nov 2026 05:21:16 +0800 Subject: [PATCH] test(index): wait for the snapshot instead of a fixed 150 ms incremental_changes_refresh_the_warm_start_snapshot failed on loaded CI runners (macOS and Windows): the snapshot is written on the worker's next round after a short delay, which a fixed sleep doesn't always cover. The test now polls for it. --- crates/ide-index/src/tests.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/ide-index/src/tests.rs b/crates/ide-index/src/tests.rs index 28699dbec8..8376d4122e 100644 --- a/crates/ide-index/src/tests.rs +++ b/crates/ide-index/src/tests.rs @@ -779,8 +779,13 @@ fn incremental_changes_refresh_the_warm_start_snapshot() { let changed = f.write("src/a.rs", "fn renamed() {}\n"); idx.update(&[changed], &[]); assert!(idx.wait_idle(WAIT)); - std::thread::sleep(Duration::from_millis(150)); - assert!(f.cache.join("index.snapshot").exists(), "a watcher update must regenerate the snapshot"); + // The snapshot is written after a short delay, on the worker's next round. + let snapshot = f.cache.join("index.snapshot"); + let deadline = std::time::Instant::now() + WAIT; + while !snapshot.exists() && std::time::Instant::now() < deadline { + std::thread::sleep(Duration::from_millis(20)); + } + assert!(snapshot.exists(), "a watcher update must regenerate the snapshot"); } #[test]