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:
parent
ab1ecb2084
commit
842d1eb489
1 changed files with 9 additions and 5 deletions
|
@ -202,18 +202,22 @@ class TestConnectionPool < Minitest::Test
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_checkout_timeout_override
|
def test_checkout_timeout_override
|
||||||
pool = ConnectionPool.new(:timeout => 0.05, :size => 1) { NetworkConnection.new }
|
pool = ConnectionPool.new(:timeout => 0, :size => 1) { NetworkConnection.new }
|
||||||
Thread.new do
|
|
||||||
|
thread = Thread.new do
|
||||||
pool.with do |net|
|
pool.with do |net|
|
||||||
net.do_something
|
net.do_something
|
||||||
sleep 0.2
|
sleep 0.01
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sleep 0.05
|
|
||||||
|
Thread.pass while thread.status == 'run'
|
||||||
|
|
||||||
assert_raises Timeout::Error do
|
assert_raises Timeout::Error do
|
||||||
pool.checkout
|
pool.checkout
|
||||||
end
|
end
|
||||||
assert pool.checkout :timeout => 0.3
|
|
||||||
|
assert pool.checkout :timeout => 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_passthru
|
def test_passthru
|
||||||
|
|
Loading…
Reference in a new issue