mirror of
https://github.com/mperham/connection_pool
synced 2023-03-27 23:22:21 -04:00
Test checkin after multiple checkouts
The local thread records how many times a connection has been checked out so it can be returned to the pool when all have been checked in.
This commit is contained in:
parent
0e2f44fefe
commit
13a85414cf
1 changed files with 19 additions and 0 deletions
|
@ -130,6 +130,25 @@ class TestConnectionPool < Minitest::Test
|
|||
end
|
||||
end
|
||||
|
||||
def test_checkin_twice
|
||||
pool = ConnectionPool.new(:timeout => 0, :size => 1) { Object.new }
|
||||
|
||||
pool.checkout
|
||||
pool.checkout
|
||||
|
||||
pool.checkin
|
||||
|
||||
assert_raises Timeout::Error do
|
||||
Thread.new do
|
||||
pool.checkout
|
||||
end.join
|
||||
end
|
||||
|
||||
pool.checkin
|
||||
|
||||
assert Thread.new { pool.checkout }.join
|
||||
end
|
||||
|
||||
def test_checkout
|
||||
pool = ConnectionPool.new(:size => 1) { NetworkConnection.new }
|
||||
|
||||
|
|
Loading…
Reference in a new issue