From a5e6f44ef63df707877d3cbcf72eccb5326ec021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 24 Jan 2018 17:58:48 -0500 Subject: Skip test that use fork in the memory store db --- .../connection_adapters/connection_handler_test.rb | 66 +++++++++++----------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb index ef0b00b36c..d4b299e330 100644 --- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb +++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb @@ -171,44 +171,46 @@ module ActiveRecord assert_equal 3, ActiveRecord::Base.connection.select_value("SELECT COUNT(*) FROM people") end - def test_forked_child_recovers_from_disconnected_parent - object_id = ActiveRecord::Base.connection.object_id - assert ActiveRecord::Base.connection.active? - - rd, wr = IO.pipe - rd.binmode - wr.binmode - - outer_pid = fork { - ActiveRecord::Base.connection.disconnect! - - pid = fork { - rd.close - if ActiveRecord::Base.connection.active? - pair = [ActiveRecord::Base.connection.object_id, - ActiveRecord::Base.connection.select_value("SELECT COUNT(*) FROM people")] - wr.write Marshal.dump pair - end - wr.close - - exit # allow finalizers to run + unless in_memory_db? + def test_forked_child_recovers_from_disconnected_parent + object_id = ActiveRecord::Base.connection.object_id + assert ActiveRecord::Base.connection.active? + + rd, wr = IO.pipe + rd.binmode + wr.binmode + + outer_pid = fork { + ActiveRecord::Base.connection.disconnect! + + pid = fork { + rd.close + if ActiveRecord::Base.connection.active? + pair = [ActiveRecord::Base.connection.object_id, + ActiveRecord::Base.connection.select_value("SELECT COUNT(*) FROM people")] + wr.write Marshal.dump pair + end + wr.close + + exit # allow finalizers to run + } + + Process.waitpid pid } - Process.waitpid pid - } - - wr.close + wr.close - Process.waitpid outer_pid - child_id, child_count = Marshal.load(rd.read) + Process.waitpid outer_pid + child_id, child_count = Marshal.load(rd.read) - assert_not_equal object_id, child_id - rd.close + assert_not_equal object_id, child_id + rd.close - assert_equal 3, child_count + assert_equal 3, child_count - # Outer connection is unaffected - assert_equal 6, ActiveRecord::Base.connection.select_value("SELECT 2 * COUNT(*) FROM people") + # Outer connection is unaffected + assert_equal 6, ActiveRecord::Base.connection.select_value("SELECT 2 * COUNT(*) FROM people") + end end def test_retrieve_connection_pool_copies_schema_cache_from_ancestor_pool -- cgit v1.2.3