未验证 提交 be8b7674 编写于 作者: R Ryuta Kamizono 提交者: GitHub

Merge pull request #37789 from dr-itz/fix/ar-test-fork

fix(test): only test reaper with fork when fork is available
......@@ -127,31 +127,33 @@ def test_reap_flush_on_discarded_pool
pool.flush
end
def test_connection_pool_starts_reaper_in_fork
pool_config = duplicated_pool_config
pool_config.db_config.configuration_hash[:reaping_frequency] = "0.0001"
pool = ConnectionPool.new(pool_config)
pool.checkout
if Process.respond_to?(:fork)
def test_connection_pool_starts_reaper_in_fork
pool_config = duplicated_pool_config
pool_config.db_config.configuration_hash[:reaping_frequency] = "0.0001"
pid = fork do
pool = ConnectionPool.new(pool_config)
pool.checkout
conn, child = new_conn_in_thread(pool)
child.terminate
pid = fork do
pool = ConnectionPool.new(pool_config)
wait_for_conn_idle(conn)
if conn.in_use?
exit!(1)
else
exit!(0)
conn, child = new_conn_in_thread(pool)
child.terminate
wait_for_conn_idle(conn)
if conn.in_use?
exit!(1)
else
exit!(0)
end
end
end
Process.waitpid(pid)
assert $?.success?
ensure
pool.discard!
Process.waitpid(pid)
assert $?.success?
ensure
pool.discard!
end
end
def test_reaper_does_not_reap_discarded_connection_pools
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册