-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance/mitigate flaky tests #139
Maintenance/mitigate flaky tests #139
Conversation
Thanks. I'll try to cherry-pick and apply the most trivial patches first and will then come back to discuss the less simple ones. |
org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/linkedediting/LinkedEditingTest.java
Outdated
Show resolved
Hide resolved
org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/linkedediting/LinkedEditingTest.java
Outdated
Show resolved
Hide resolved
org.eclipse.lsp4e.test/src/org/eclipse/lsp4e/test/linkedediting/LinkedEditingTest.java
Outdated
Show resolved
Hide resolved
Can you please tro to rebase it? |
ae94504
to
64c3700
Compare
HI @mickaelistria I've got it consistent with master now (I think) and all of the changes you cherry-picked excluded. |
Make the test teardown a bit cleaner so that some of the console noise is reduced.
Makes it easier to ascertain which tests are causing noise and have clean-up sync issues. Could possibly have made this an eclipse configuration item (as is currently the case for lsp4e wire logging) but a system property is easier to control via maven-based CI
… setup lags behind the test teardown
…lay on the mock server
…age server Stop() calls disconnect() on any disconnected documents, but disconnect() also calls stop... Multiple calls to stop() allowed (server can be restarted), just not multiple *simultaneous* calls to stop
Can't quite shut up testProjectClose() - async LSPFoldingReconciler still running in flight sometimes when files torn down Not sure what to do about that
64c3700
to
5d289a0
Compare
@ahmedneilhussain can you please bump the bundle version of
|
|
||
// Put back so shutdown doesn't time out | ||
MockLanguageServer.INSTANCE.setTimeToProceedQueries(0); | ||
assertTrue(command.isEnabled() && command.isHandled()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please keep the asserts separate:
assertTrue(command.isEnabled());
assertTrue(command.isHandled());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - the email notification of your comment only arrived after I had independently fixed the build errors and @mickaelistria had merged... Please feel free to revert to two separate asserts.
@@ -59,6 +59,8 @@ public class TestUtils { | |||
private TestUtils() { | |||
// this class shouldn't be instantiated | |||
} | |||
|
|||
private static List<File> tempFiles = new ArrayList<>(); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, was a merge clash caused by this part of the original PR being cherry picked out and integrated independently a few weeks ago. Fixed anyway!
@@ -53,14 +59,17 @@ protected void finished(Description description) { | |||
} | |||
|
|||
private void clear() { | |||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); | |||
// Give the platform three attempts to shut down windows | |||
for (int i = 3; i > 0 && !PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); i--) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of doing this in a loop without a sleep or something in between?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a fairly long-running call so I didn't feel the need to stick a sleep in between, but I take your point!
Thanks! |
I've merged it already so the PR doesn't remain as a zombie for a too long time until it becomes harder to merge it. Further PRs to improve it are welcome. |
This would probably be better entitled 'mitigate noisy tests' - I found there was an awful lot of noise from the teardown code having race conditions with some of the lazily server startup/document connection. I think this was mostly benign but made it very hard to try and see what the problem might be when investigating test failures. Although it turns out benign exceptions that just get logged are not so benign if
NoErrorLoggedRule
is being used! The logs are a lot quieter now, hopefully, and I've found and tried to fix a few definite cases of flakiness.The changes can be summarised:
TestUtils
andAllClearRule
so that where possible files are not deleted while document connection might still be pending in a Job queue or worker pool. Changed a lot of existing tests to use this common framework rather than doing it with duplicated logic (minus the synchronisation)EOF
to close the corresponding paired stream. This got rid of a lot of theAsynchronousCloseException
sI think b8340c3 is an outright bug fix rather than a testing improvement, because the stop() and disconnect() could both call one another resulting in multiple 'shutdown' jobs being scheduled. I nearly introduced a bug because I forgot that language servers can be restarted once stopped but I hope I've got this right. Would be very grateful if someone else can take a look.