1
0
Fork 0
mirror of https://github.com/mperham/connection_pool synced 2023-03-27 23:22:21 -04:00

Speed up test_checkout_timeout_override

This commit is contained in:
Eric Hodel 2014-02-14 16:26:05 -08:00
parent ab1ecb2084
commit 842d1eb489

View file

@ -202,18 +202,22 @@ class TestConnectionPool < Minitest::Test
end
def test_checkout_timeout_override
pool = ConnectionPool.new(:timeout => 0.05, :size => 1) { NetworkConnection.new }
Thread.new do
pool = ConnectionPool.new(:timeout => 0, :size => 1) { NetworkConnection.new }
thread = Thread.new do
pool.with do |net|
net.do_something
sleep 0.2
sleep 0.01
end
end
sleep 0.05
Thread.pass while thread.status == 'run'
assert_raises Timeout::Error do
pool.checkout
end
assert pool.checkout :timeout => 0.3
assert pool.checkout :timeout => 0.1
end
def test_passthru