Fix resource leakage in messaging.test_queues
Test messaging.test_queues.test_delete_queue does pop 1 element from
shared list (self.queues which is being used by other tests as well
as in resource cleanup) and then delete request is done.
In case where delete request fails then it cause other tests to fail
and resource leakage as element has been removed from self.queues
even before actual deletion.
Individual test should not be side-effecting mutable class variables
that are used by other tests. So merging delete tests with create tests.
Closes-Bug: #1377031
Change-Id: If24a903160e716a685d7121e0968881542f072fc
diff --git a/tempest/api/messaging/test_queues.py b/tempest/api/messaging/test_queues.py
index 8f9ac20..dc286ad 100644
--- a/tempest/api/messaging/test_queues.py
+++ b/tempest/api/messaging/test_queues.py
@@ -20,6 +20,7 @@
from tempest.api.messaging import base
from tempest.common.utils import data_utils
+from tempest import exceptions
from tempest import test
@@ -29,8 +30,8 @@
class TestQueues(base.BaseMessagingTest):
@test.attr(type='smoke')
- def test_create_queue(self):
- # Create Queue
+ def test_create_delete_queue(self):
+ # Create & Delete Queue
queue_name = data_utils.rand_name('test-')
_, body = self.create_queue(queue_name)
@@ -38,6 +39,12 @@
self.assertEqual('', body)
+ _, body = self.delete_queue(queue_name)
+ self.assertEqual('', body)
+ self.assertRaises(exceptions.NotFound,
+ self.client.get_queue,
+ queue_name)
+
class TestManageQueue(base.BaseMessagingTest):
_interface = 'json'
@@ -53,13 +60,6 @@
cls.client.create_queue(queue_name)
@test.attr(type='smoke')
- def test_delete_queue(self):
- # Delete Queue
- queue_name = self.queues.pop()
- _, body = self.delete_queue(queue_name)
- self.assertEqual('', body)
-
- @test.attr(type='smoke')
def test_check_queue_existence(self):
# Checking Queue Existence
for queue_name in self.queues: