fix(test): test_create_with_query_cache #387
Merged
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.
Problem
test_create_with_query_cachefails quite often, but it is a flaky test, and fast local reproduction is difficult.Exploration
I started a bunch of parallel tests (256 is the maximum allowed by Github Actions), and checked if one was failing fast. Then isolated the related tests, and restarted. Once with a limited amount of tests, I could check in a more linear fashion which tests were leading to the bad conditions. And here a constant reproduction (Rails 8.0.3, CRDB 25.2):
Reproduction time is 5s and we isolated two test. Now we should be able to pinpoint the issue.
Bug reproduction
If we use this reproduction with
git bisect, we can see that the first bug come from commit 63e8e86Conclusion
Based on this search and some debugging, I saw that the root cause came from rails/rails#52428. The fix is trivial though.
I took the opportunity to extract my way of isolating the test through a new 'flaky.yml' workflow. That will allow us to be more efficient on flaky tests. And there are still some...