Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84d3c32

Browse files
authored
Merge pull request #57434 from yahonda/yahonda/pg-test-load-async-pool
Run LoadAsync\*ThreadPoolExecutorTest on the replaced pool to prevent connection leak
2 parents ff53755 + 0c80f63 commit 84d3c32

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

activerecord/test/cases/relation/load_async_test.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ class LoadAsyncMultiThreadPoolExecutorTest < ActiveRecord::TestCase
415415

416416
fixtures :posts, :comments
417417

418-
def setup
418+
def before_setup
419419
@old_config = ActiveRecord.async_query_executor
420420
ActiveRecord.async_query_executor = :multi_thread_pool
421421

@@ -424,9 +424,12 @@ def setup
424424

425425
ActiveRecord::Base.establish_connection(config_hash1)
426426
ARUnit2Model.establish_connection(config_hash2)
427+
428+
super
427429
end
428430

429-
def teardown
431+
def after_teardown
432+
super
430433
ActiveRecord.async_query_executor = @old_config
431434
clean_up_connection_handler
432435
ActiveRecord::Base.establish_connection(:arunit)
@@ -554,7 +557,7 @@ class LoadAsyncMixedThreadPoolExecutorTest < ActiveRecord::TestCase
554557

555558
fixtures :posts, :comments, :other_dogs
556559

557-
def setup
560+
def before_setup
558561
@previous_env, ENV["RAILS_ENV"] = ENV["RAILS_ENV"], "default_env"
559562
@old_config = ActiveRecord.async_query_executor
560563
ActiveRecord.async_query_executor = :multi_thread_pool
@@ -570,9 +573,12 @@ def setup
570573

571574
ActiveRecord::Base.establish_connection(:primary)
572575
ARUnit2Model.establish_connection(:animals)
576+
577+
super
573578
end
574579

575-
def teardown
580+
def after_teardown
581+
super
576582
ENV["RAILS_ENV"] = @previous_env
577583
ActiveRecord::Base.configurations = @prev_configs
578584
ActiveRecord.async_query_executor = @old_config

0 commit comments

Comments
 (0)