Skip to content

Commit 45d2e7a

Browse files
Clear query cache for QueryCacheExpiryTest as well
- This solves failure of order dependent tests when tests from QueryCacheExpiryTest class are run before the tests from QueryCacheTest class. - In above scenario, the warmed cache created by tests from QueryCacheExpiryTest class is never cleared before running first test from QueryCacheTest class. So first test from QueryCacheTest class was always failing. - Reproduction `bundle exec ruby -Itest test/cases/query_cache_test.rb --seed 60165 -v`
1 parent d91ca77 commit 45d2e7a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

activerecord/test/cases/query_cache_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,10 @@ def assert_cache(state, connection = ActiveRecord::Base.connection)
388388
class QueryCacheExpiryTest < ActiveRecord::TestCase
389389
fixtures :tasks, :posts, :categories, :categories_posts
390390

391+
teardown do
392+
Task.connection.clear_query_cache
393+
end
394+
391395
def test_cache_gets_cleared_after_migration
392396
# warm the cache
393397
Post.find(1)

0 commit comments

Comments
 (0)