Skip to content

fix(test): replace fixed sleep with readiness poll in RA integration tests#123

Merged
bug-ops merged 1 commit into
mainfrom
121-ra-tests-flaky-parallel
Apr 29, 2026
Merged

fix(test): replace fixed sleep with readiness poll in RA integration tests#123
bug-ops merged 1 commit into
mainfrom
121-ra-tests-flaky-parallel

Conversation

@bug-ops

@bug-ops bug-ops commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replaced all 17 fixed sleeps (3s/5s) in rust_analyzer_tests.rs with a wait_for_indexing_ready() poll helper that returns on the first textDocument/publishDiagnostics or $/progress{kind:end} notification, with a 30s hard timeout
  • Switched LspServer::spawn() to from_transport_with_notifications() so push notifications flow into a dedicated mpsc channel exposed as pub notification_rx on LspServer
  • Added Progress variant to LspNotification for $/progress messages
  • Removed the unconditional 2s sleep in test_invalid_file_path (no indexing readiness needed)

Root cause

Under parallel test execution (10+ rust-analyzer instances), CPU contention caused workspace indexing to exceed the fixed timeout, producing empty LSP responses in ~30% of runs.

Test plan

  • cargo nextest run --workspace --all-features --lib --bins — 345/345 passed
  • cargo clippy --all-targets --all-features --workspace -- -D warnings — clean
  • cargo +nightly fmt --all -- --check — clean
  • --ignored integration tests should now pass reliably in parallel (requires rust-analyzer in PATH)

Closes #121

…tests

setup_rust_analyzer() waited a fixed 3s (or 5s) for rust-analyzer to
finish indexing. Under parallel execution (10+ instances), CPU contention
caused indexing to exceed the timeout, producing empty LSP responses in
~30% of runs.

Switch LspServer::spawn() to from_transport_with_notifications() so push
notifications flow into a tokio mpsc channel. Add a Progress variant to
LspNotification for $/progress messages. Export LspNotification from
lsp::mod. Add wait_for_indexing_ready() to the integration test module:
polls the channel and returns on the first PublishDiagnostics or
$/progress{kind:end} notification, with a 30s hard timeout.

Replace all 17 fixed sleeps in rust_analyzer_tests.rs with the poll
helper. Remove the 2s sleep in test_invalid_file_path (no readiness
signal needed there).

Closes #121
@bug-ops bug-ops enabled auto-merge (squash) April 29, 2026 16:22
@github-actions github-actions Bot added rust Rust code changes testing Test-related changes mcpls-core mcpls-core crate changes labels Apr 29, 2026
@bug-ops bug-ops merged commit 83350c6 into main Apr 29, 2026
27 checks passed
@bug-ops bug-ops deleted the 121-ra-tests-flaky-parallel branch April 29, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mcpls-core mcpls-core crate changes rust Rust code changes testing Test-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

integration tests: rust-analyzer tests flaky under parallel execution due to fixed 3s indexing wait

1 participant