Fix flaky IndexSetupTests on RavenDB - #5805
Merged
Merged
Conversation
abparticular
marked this pull request as ready for review
August 20, 2026 02:25
johnsimons
approved these changes
Aug 20, 2026
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.
IndexSetupTests.Indexes_should_be_reset_on_setup(and its sibling paths throughUpdateIndex) has been failing intermittently on CI with an unhandled exception fromWaitForIndexDefinitionUpdate.The polling loop already tolerated a plain
OperationCanceledException, with a comment noting "we can get this if we query right when the update happens", but that only covered the client-side cancellation shape. In practice, queryingGetIndexStatisticsOperationright as RavenDB swaps an index's underlying storage engine during a reset can throw a variety of transient errors, not just that one:OperationCanceledExceptionfrom the read transaction being cancelled as the reset startsObjectDisposedException("Index persistence for index '...' was already disposed"), from the old engine's index persistence (e.g. Lucene) being torn down once the reset takes overBoth surfaced in real CI failures as Raven.Client.Exceptions.RavenException. RavenDB reconstructs a generic wrapper client-side for server exceptions it doesn't specifically know how to rehydrate, so the original type/message ends up embedded in RavenException.Message rather than as a genuine .InnerException.
WaitForIndexDefinitionUpdatenow tolerates up toMaxTransientRavenExceptionRetries(2) consecutiveRavenExceptionsof any kind before letting one propagate.A genuinely broken index (or a bug in the test itself) still fails fast with its real exception, rather than being silently retried for the rest of the test's 30s timeout budget.
Also moved RavenDB DeleteDatabase code into the TestHelper since it is only tests that are deleting databases.