Repository navigation
test: LanguageServerProcessNodesTest disposes the language server of a failed start once the server keeps its notification - #2331
Merged
lagergren merged 1 commit intoNov 28, 2026
Conversation
…a failed start once the server keeps its notification testADisposedLanguageServerExpiresItsCannotStartNotification disposed the language server as soon as its "Cannot start server" notification was shown. LanguageServerWrapper keeps the notification only after it is shown, on the thread of the failed start, so the dispose could come in between: it found no notification to expire, and the thread of the start expired it right after, once the test had asserted. That case is what testACannotStartNotificationShownWhileItsLanguageServerIsDisposedExpires covers. The test now waits until the failed start reports its error, which it does once it kept the notification, and still asserts that the dispose expires the notification at once. With a pause of one second between the notification and its keeping, the test failed every time at the line where it failed on CI. It passes with the pause now. Fixes redhat-developer#2330
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2331 +/- ##
=======================================
Coverage 58.63% 58.63%
=======================================
Files 849 849
Lines 36704 36709 +5
Branches 7606 7608 +2
=======================================
+ Hits 21520 21524 +4
- Misses 12183 12189 +6
+ Partials 3001 2996 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
@coderabbitai review |
Action performed
|
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.
Fixes #2330
LanguageServerProcessNodesTest.testADisposedLanguageServerExpiresItsCannotStartNotificationfailed once on Linux, in the first CI run of #2328, which doesn't touch the LSP console. Onetest:commit, for contributors only; no change to LSP4IJ itself. For 0.30.2.Cause: the test
LanguageServerWrapper.showNotificationStartServerErrorshows the "Cannot start server" notification, then keeps it inerrorNotification, on the thread of the failed start. The test waited only until the notification was shown, so its dispose could come in between:The product is right in both orders.
testACannotStartNotificationShownWhileItsLanguageServerIsDisposedExpirescovers the dispose while the notification is shown, and waits for the expiry.Fix
The test waits until the failed start reports its error to the lifecycle listeners (
handleError), which it does once it kept the notification, before it disposes the language server. It still asserts that the dispose expires the notification at once.Proof
With a temporary pause of one second in
showNotificationStartServerError, between the notification anderrorNotification = notification:junit.framework.AssertionFailedErrortestACannotStartNotificationShownWhileItsLanguageServerIsDisposedExpiresWithout the pause, headless, with the counts from the JUnit XMLs:
LanguageServerProcessNodesTest