Changes to ensure delete_containers is done at class level tear down

Invoking delete containers at test level tearDown caused:
1) unnecessary requests are being sent again in the tearDown for
the subsequent methods,
2) possible race condition can happen between methods during the
tearDown.

Closes-Bug: #1938593

Change-Id: I24087607a9f0129b7b3d21473196fab1b5f08cd4
changes/88/802388/6
Huy Tran 2 years ago
parent 027a27c65d
commit 3c7159d2e3

@ -31,9 +31,10 @@ class ObjectTestACLs(base.BaseObjectTest):
super(ObjectTestACLs, self).setUp()
self.container_name = self.create_container()
def tearDown(self):
self.delete_containers()
super(ObjectTestACLs, self).tearDown()
@classmethod
def resource_cleanup(cls):
cls.delete_containers()
super(ObjectTestACLs, cls).resource_cleanup()
@decorators.idempotent_id('a3270f3f-7640-4944-8448-c7ea783ea5b6')
def test_read_object_with_rights(self):

@ -42,9 +42,10 @@ class ObjectACLsNegativeTest(base.BaseObjectTest):
self.container_name = data_utils.rand_name(name='TestContainer')
self.container_client.update_container(self.container_name)
def tearDown(self):
self.delete_containers([self.container_name])
super(ObjectACLsNegativeTest, self).tearDown()
@classmethod
def resource_cleanup(cls):
cls.delete_containers()
super(ObjectACLsNegativeTest, cls).resource_cleanup()
@decorators.attr(type=['negative'])
@decorators.idempotent_id('af587587-0c24-4e15-9822-8352ce711013')

@ -44,10 +44,10 @@ class ContainerQuotasTest(base.BaseObjectTest):
self.container_client.create_update_or_delete_container_metadata(
self.container_name, create_update_metadata=metadata)
def tearDown(self):
"""Cleans the container of any object after each test."""
self.delete_containers()
super(ContainerQuotasTest, self).tearDown()
@classmethod
def resource_cleanup(cls):
cls.delete_containers()
super(ContainerQuotasTest, cls).resource_cleanup()
@decorators.idempotent_id('9a0fb034-86af-4df0-86fa-f8bd7db21ae0')
@utils.requires_ext(extension='container_quotas', service='object')

@ -21,9 +21,10 @@ from tempest.lib import decorators
class ContainerTest(base.BaseObjectTest):
"""Test containers"""
def tearDown(self):
self.delete_containers()
super(ContainerTest, self).tearDown()
@classmethod
def resource_cleanup(cls):
cls.delete_containers()
super(ContainerTest, cls).resource_cleanup()
@decorators.attr(type='smoke')
@decorators.idempotent_id('92139d73-7819-4db1-85f8-3f2f22a8d91f')

Loading…
Cancel
Save