Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ensure that released connections move between threads

  • Loading branch information...
commit 657095d8bbec51999d66b379245e8d3466ee27af 1 parent d523504
@tenderlove tenderlove authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 activerecord/test/cases/connection_pool_test.rb
View
18 activerecord/test/cases/connection_pool_test.rb
@@ -31,6 +31,24 @@ def active_connections(pool)
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
Please sign in to comment.
Something went wrong with that request. Please try again.