diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-01-31 12:52:16 -0500 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-01-31 12:56:37 -0500 |
| commit | d4d0eedeb43cd0bcb9fd446d0ef9bbcc3b28c68a (patch) | |
| tree | 789fe46ef814f26f35d7584b1f403bf55573e2d5 | |
| parent | 59c0a723cc6d9e0c298d581952bde6853c2288c7 (diff) | |
| download | nova-d4d0eedeb43cd0bcb9fd446d0ef9bbcc3b28c68a.tar.gz nova-d4d0eedeb43cd0bcb9fd446d0ef9bbcc3b28c68a.tar.xz nova-d4d0eedeb43cd0bcb9fd446d0ef9bbcc3b28c68a.zip | |
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
| -rw-r--r-- | nova/tests/rpc/test_qpid.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/tests/rpc/test_qpid.py b/nova/tests/rpc/test_qpid.py index b08c7b96d..0417674b8 100644 --- a/nova/tests/rpc/test_qpid.py +++ b/nova/tests/rpc/test_qpid.py @@ -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() |
