fix(test): replace fixed sleep with readiness poll in RA integration tests#123
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rust_analyzer_tests.rswith await_for_indexing_ready()poll helper that returns on the firsttextDocument/publishDiagnosticsor$/progress{kind:end}notification, with a 30s hard timeoutLspServer::spawn()tofrom_transport_with_notifications()so push notifications flow into a dedicatedmpscchannel exposed aspub notification_rxonLspServerProgressvariant toLspNotificationfor$/progressmessagestest_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 passedcargo clippy --all-targets --all-features --workspace -- -D warnings— cleancargo +nightly fmt --all -- --check— clean--ignoredintegration tests should now pass reliably in parallel (requires rust-analyzer in PATH)Closes #121