aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2018-01-24 17:58:48 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2018-01-24 18:04:10 -0500
commita5e6f44ef63df707877d3cbcf72eccb5326ec021 (patch)
tree2371df2a69c98604c77f88c5a8fd8f2773b765c1 /activerecord/test/cases
parent554dcc4c6ec3339507e9b05235c417e0ed00e1c4 (diff)
downloadrails-a5e6f44ef63df707877d3cbcf72eccb5326ec021.tar.gz
rails-a5e6f44ef63df707877d3cbcf72eccb5326ec021.tar.bz2
rails-a5e6f44ef63df707877d3cbcf72eccb5326ec021.zip
Skip test that use fork in the memory store db
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb66
1 files changed, 34 insertions, 32 deletions
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