Skip to content

Commit

Permalink
Merge pull request #49030 from fatkodima/optimize-ar-tests
Browse files Browse the repository at this point in the history
Speedup activerecord tests
  • Loading branch information
rafaelfranca committed Aug 24, 2023
2 parents 90bdbe0 + df12ca0 commit 704256e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions activerecord/test/cases/query_cache_test.rb
Expand Up @@ -584,6 +584,8 @@ def test_query_caching_is_local_to_the_current_thread
Thread.new {
assert_not ActiveRecord::Base.connection_pool.query_cache_enabled
assert_not ActiveRecord::Base.connection.query_cache_enabled

ActiveRecord::Base.connection_handler.clear_active_connections!(:all)
}.join
}.call({})
end
Expand Down
8 changes: 7 additions & 1 deletion activerecord/test/support/connection.rb
Expand Up @@ -21,7 +21,13 @@ def self.test_configuration_hashes
def self.connect
ActiveRecord.async_query_executor = :global_thread_pool
puts "Using #{connection_name}"
ActiveRecord::Base.logger = ActiveSupport::Logger.new("debug.log", 1, 100 * 1024 * 1024)

if ENV["CI"]
ActiveRecord::Base.logger = nil
else
ActiveRecord::Base.logger = ActiveSupport::Logger.new("debug.log", 1, 100.megabytes)
end

ActiveRecord::Base.configurations = test_configuration_hashes
ActiveRecord::Base.establish_connection :arunit
ARUnit2Model.establish_connection :arunit2
Expand Down

0 comments on commit 704256e

Please sign in to comment.