Skip to content
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

Fix flaky tests for RedisCacheStore #45732

Merged
merged 1 commit into from Aug 2, 2022

Conversation

fatkodima
Copy link
Member

Rails uses several processes to run tests for RedisCacheStore via bin/test test/cache/store/redis_cache_store_test.rb.
When they run serially (with PARALLEL_WORKERS=1) - everything works as expected, but in parallel - I almost always saw failing tests.

With this changes I ran tests 100 times and saw no errors.

cc @byroot

@@ -131,9 +131,9 @@ def test_read_multi_with_expires
end

def test_read_multi_with_empty_keys_and_a_logger_and_no_namespace
@cache.options[:namespace] = nil
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the main offending line - we reset the namespace, and @cache.clear in teardown just flushed the db and we get nils in our tests.

@byroot byroot merged commit 562a038 into rails:main Aug 2, 2022
@byroot
Copy link
Member

byroot commented Aug 2, 2022

Thank you.

@fatkodima fatkodima deleted the redis-cache-store-flaky-tests branch August 2, 2022 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants