Visitar URL original
Fix various test flakiness by aeisenberg · Pull Request #2331 · github/vscode-codeql · GitHub
The Wayback Machine - https://web.archive.org/web/20260605024017/https://github.com/github/vscode-codeql/pull/2331
Skip to content

Fix various test flakiness#2331

Merged
aeisenberg merged 2 commits into
mainfrom
aeisenberg/fix-flakes
Apr 17, 2023
Merged

Fix various test flakiness#2331
aeisenberg merged 2 commits into
mainfrom
aeisenberg/fix-flakes

Conversation

@aeisenberg
Copy link
Copy Markdown
Contributor

This commit addresses various test flakiness:

  1. Bump timeouts for queries tests
  2. Add a dispose handler to queryserver-client. This will help us during tests because if there is a test that timesout while a query is running, the query's progress callback won't be invoked. We will still get a timeout error in the first test, but the second test will not get a spurious error.
  3. Handle a disposed query server in deregisterDatabase. This method will remove the database from the currently running query server. If there is no query server, then there is nothing to remove. So, this error is safe to ignore.
  4. Explicitly end() a connection ServerProcess. I'm not 100% sure if this is necessary, but it seems like it prevents responses from being handled and erroring out.
  5. Better handling of ideServer restarts. Previously, if you quickly called CodeQL: Restart Query Server twice in a row, you would get an error from the ideServer restart. Restart fails if the server is not already started. So, in this case just call a start.

This commit addresses various test flakiness:

1. Bump timeouts for queries tests
2. Add a dispose handler to queryserver-client. This will help us during
   tests because if there is a test that timesout while a query is
   running, the query's progress callback won't be invoked. We will
   still get a timeout error in the first test, but the second test will
   not get a spurious error.
3. Handle a disposed query server in `deregisterDatabase`. This method
   will remove the database from the currently running query server.
   If there is no query server, then there is nothing to remove. So,
   this error is safe to ignore.
4. Explicitly `end()` a connection `ServerProcess`. I'm not 100% sure if
   this is necessary, but it seems like it prevents responses from being
   handled and erroring out.
5. Better handling of ideServer restarts. Previously, if you quickly
   called `CodeQL: Restart Query Server` twice in a row, you would get
   an error from the ideServer restart. Restart fails if the server is
   not already started. So, in this case just call a start.
@aeisenberg aeisenberg requested a review from a team as a code owner April 14, 2023 17:51
@aeisenberg
Copy link
Copy Markdown
Contributor Author

My change to bump the timeout probably conflicts with #2326. I can remove that.

A global timeout has already been set.
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have much context on many of these areas, but everything here looks reasonable. I can't see anything obviously missing, but I also wouldn't have known to add these. But this looks like it'll make us behave more correctly and consistently.

@aeisenberg
Copy link
Copy Markdown
Contributor Author

Thanks for the review. It's always really hard to know if you've actually solved the issues behind a flaky test. Hopefully, this will help.

@aeisenberg aeisenberg merged commit cc241d0 into main Apr 17, 2023
@aeisenberg aeisenberg deleted the aeisenberg/fix-flakes branch April 17, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants