1
0
Fork 0
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:
Eric Hodel 2014-02-14 15:07:35 -08:00
parent 0e2f44fefe
commit 13a85414cf

View file

@ -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 }