diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-08 16:12:49 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-08 16:12:49 -0800 |
commit | 657095d8bbec51999d66b379245e8d3466ee27af (patch) | |
tree | 8764c4b7f9dcea4d1ca37149dff555a40637d1f0 /activerecord | |
parent | d523504c2f18e459e21a8cfa019ef0620db61b79 (diff) | |
download | rails-657095d8bbec51999d66b379245e8d3466ee27af.tar.gz rails-657095d8bbec51999d66b379245e8d3466ee27af.tar.bz2 rails-657095d8bbec51999d66b379245e8d3466ee27af.zip |
ensure that released connections move between threads
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/connection_pool_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index 25375c5f7a..861ae7e120 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -31,6 +31,24 @@ module ActiveRecord pool.connections.find_all(&:in_use?) end + def test_released_connection_moves_between_threads + thread_conn = nil + + Thread.new { + pool.with_connection do |conn| + thread_conn = conn + end + }.join + + assert thread_conn + + Thread.new { + pool.with_connection do |conn| + assert_equal thread_conn, conn + end + }.join + end + def test_with_connection assert_equal 0, active_connections(pool).size |