Be more explicit about emptying connection pool.
This patch makes some code in test_qpid be more explicit about emptying the connection pool. It now ensures that it removes exactly how many connections are in the pool. The previous code made a couple of assumptions. First, it assumed that only one connection was in the pool (which is true, but it's still nice not to make the assumption here in the cleanup code). Second, it assumed that free() returned the number of connections that have been placed in the pool. This is not correct. The result also includes the number of connections that could be created based on the max size of the pool. Use the free_items attribute instead, which gives the exact number of connections that have been put() in the pool. Change-Id: I97378919c2d3e68f224862f07a75529575647163
This commit is contained in:
parent
59c0a723cc
commit
d4d0eedeb4
@ -186,7 +186,7 @@ class RpcQpidTestCase(test.TestCase):
|
||||
|
||||
self.mocker.VerifyAll()
|
||||
finally:
|
||||
if rpc_amqp.ConnectionContext._connection_pool.free():
|
||||
while rpc_amqp.ConnectionContext._connection_pool.free_items:
|
||||
# Pull the mock connection object out of the connection pool so
|
||||
# that it doesn't mess up other test cases.
|
||||
rpc_amqp.ConnectionContext._connection_pool.get()
|
||||
@ -261,7 +261,7 @@ class RpcQpidTestCase(test.TestCase):
|
||||
|
||||
self.mocker.VerifyAll()
|
||||
finally:
|
||||
if rpc_amqp.ConnectionContext._connection_pool.free():
|
||||
while rpc_amqp.ConnectionContext._connection_pool.free_items:
|
||||
# Pull the mock connection object out of the connection pool so
|
||||
# that it doesn't mess up other test cases.
|
||||
rpc_amqp.ConnectionContext._connection_pool.get()
|
||||
|
Loading…
Reference in New Issue
Block a user