未验证 提交 ec4807bc 编写于 作者: E Eileen M. Uchitelle 提交者: GitHub

Merge pull request #37774 from Edouard-chin/ec-enlist-fixture-connection

Fix connection pools not shared between writer -> replica during tests:
......@@ -130,6 +130,7 @@ def setup_fixtures(config = ActiveRecord::Base)
# When connections are established in the future, begin a transaction too
@connection_subscriber = ActiveSupport::Notifications.subscribe("!connection.active_record") do |_, _, _, _, payload|
spec_name = payload[:spec_name] if payload.key?(:spec_name)
setup_shared_connection_pool
if spec_name
begin
......
......@@ -1399,13 +1399,6 @@ class MultipleDatabaseFixturesTest < ActiveRecord::TestCase
rw_conn = ActiveRecord::Base.connection
ro_conn = ActiveRecord::Base.connection_handlers[:reading].connection_pool_list.first.connection
assert_not_equal rw_conn, ro_conn
enlist_fixture_connections
rw_conn = ActiveRecord::Base.connection
ro_conn = ActiveRecord::Base.connection_handlers[:reading].connection_pool_list.first.connection
assert_equal rw_conn, ro_conn
end
ensure
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册