Skip to content

Commit

Permalink
ensure that released connections move between threads
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Mar 9, 2012
1 parent cff19cf commit 94b2c8c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions activerecord/test/cases/connection_pool_test.rb
Expand Up @@ -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

Expand Down

0 comments on commit 94b2c8c

Please sign in to comment.