-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(elasticsearch): Fix race conditions in elasticsearch tests (#4751)
The elasticsearch tests are failing intermittently because there are numerous race conditions between when index refreshes cause a mutating operation to be visible, and when we assert that the operation is visible. Currently the test cluster is set up to reindex every 1s, and we are using sleep statements and retries to ensure we wait that long before failing a test. In addition to making these tests slow, there are intermittent failures (particularly under high load) when we fail before the re-index has occurred. Let's make this deterministic as follows: (1) Manually refresh the index before verifying the status of an operation. (2) Set the refresh_interval to -1, which means never automatically refresh. This ensures that tests will always fail if we forget to invoke the manual refresh to avoid future intermittent tests. As an added benefit, this speeds up the tests significantly, as we're no longer unnecessarily waiting. In my very rough testing, the time to execute tests in this class is reduced from ~35s to ~7s.
- Loading branch information
Showing
1 changed file
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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