mirror of
https://github.com/mperham/connection_pool
synced 2023-03-27 23:22:21 -04:00
Tersify
This commit is contained in:
parent
42c642eac5
commit
67b9e26676
1 changed files with 3 additions and 11 deletions
|
@ -130,21 +130,13 @@ class TestConnectionPool < Minitest::Test
|
||||||
pool = ConnectionPool.new(:timeout => 0, :size => 1) { NetworkConnection.new }
|
pool = ConnectionPool.new(:timeout => 0, :size => 1) { NetworkConnection.new }
|
||||||
conn = pool.checkout
|
conn = pool.checkout
|
||||||
|
|
||||||
t1 = Thread.new do
|
|
||||||
pool.checkout
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_raises Timeout::Error do
|
assert_raises Timeout::Error do
|
||||||
t1.join
|
Thread.new { pool.checkout }.join
|
||||||
end
|
end
|
||||||
|
|
||||||
pool.checkin
|
pool.checkin
|
||||||
|
|
||||||
t2 = Thread.new do
|
assert_same conn, Thread.new { pool.checkout }.value
|
||||||
pool.checkout
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_same conn, t2.value
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_value
|
def test_returns_value
|
||||||
|
@ -353,7 +345,7 @@ class TestConnectionPool < Minitest::Test
|
||||||
recorder.do_work("shutdown")
|
recorder.do_work("shutdown")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal [[], ["shutdown"], ["shutdown"]], recorders.map { |r| r.calls }.sort
|
assert_equal [["shutdown"], ["shutdown"], []], recorders.map { |r| r.calls }
|
||||||
|
|
||||||
pool.checkin
|
pool.checkin
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue