You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When transactional_tests are enabled, requests to the Capybara web server don't have query cache enabled.
In the controller, ActiveRecord::Base.connection.query_cache_enabled is false
Expected behavior
The connection has query cache enabled
Actual behavior
The query cache middleware enables query caching on the pool. But since we have transactional_tests, when we get a connection, we return the shared connection (based on @lock_thread) instead of checking out a connection from the pool.
We want query cache enabled in test so that it is closer to what happens in development / production. We have tests that check for the number of uncached queries that are now failing after enabling transactional_tests.
System configuration
Rails version: 5.1.7
Ruby version: 2.6.3
The text was updated successfully, but these errors were encountered:
Steps to reproduce
When
transactional_tests
are enabled, requests to the Capybara web server don't have query cache enabled.In the controller,
ActiveRecord::Base.connection.query_cache_enabled
isfalse
Expected behavior
The connection has query cache enabled
Actual behavior
The query cache middleware enables query caching on the pool. But since we have
transactional_tests
, when we get a connection, we return the shared connection (based on@lock_thread
) instead of checking out a connection from the pool.I think this means https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L13 would not be triggered, causing query cache to not be enabled for the request
Additional information
We want query cache enabled in test so that it is closer to what happens in development / production. We have tests that check for the number of uncached queries that are now failing after enabling
transactional_tests
.System configuration
Rails version: 5.1.7
Ruby version: 2.6.3
The text was updated successfully, but these errors were encountered: