Merge "Migrate object_storage API tests to resource_* fixtures"
This commit is contained in:
commit
9f7439063c
@ -28,9 +28,9 @@ CONF = config.CONF
|
||||
class BaseObjectTest(tempest.test.BaseTestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
def resource_setup(cls):
|
||||
cls.set_network_resources()
|
||||
super(BaseObjectTest, cls).setUpClass()
|
||||
super(BaseObjectTest, cls).resource_setup()
|
||||
if not CONF.service_available.swift:
|
||||
skip_msg = ("%s skipped as swift is not available" % cls.__name__)
|
||||
raise cls.skipException(skip_msg)
|
||||
@ -72,10 +72,10 @@ class BaseObjectTest(tempest.test.BaseTestCase):
|
||||
cls.data = SwiftDataGenerator(cls.identity_admin_client)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.data.teardown_all()
|
||||
cls.isolated_creds.clear_isolated_creds()
|
||||
super(BaseObjectTest, cls).tearDownClass()
|
||||
super(BaseObjectTest, cls).resource_cleanup()
|
||||
|
||||
@classmethod
|
||||
def delete_containers(cls, containers, container_client=None,
|
||||
|
@ -26,9 +26,8 @@ CONF = config.CONF
|
||||
class AccountQuotasTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(AccountQuotasTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(AccountQuotasTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name="TestContainer")
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
|
||||
@ -71,10 +70,10 @@ class AccountQuotasTest(base.BaseObjectTest):
|
||||
super(AccountQuotasTest, self).tearDown()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
if hasattr(cls, "container_name"):
|
||||
cls.delete_containers([cls.container_name])
|
||||
super(AccountQuotasTest, cls).tearDownClass()
|
||||
super(AccountQuotasTest, cls).resource_cleanup()
|
||||
|
||||
@test.attr(type="smoke")
|
||||
@test.requires_ext(extension='account_quotas', service='object')
|
||||
|
@ -27,9 +27,8 @@ CONF = config.CONF
|
||||
class AccountQuotasNegativeTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(AccountQuotasNegativeTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(AccountQuotasNegativeTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name="TestContainer")
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
|
||||
@ -71,10 +70,10 @@ class AccountQuotasNegativeTest(base.BaseObjectTest):
|
||||
super(AccountQuotasNegativeTest, self).tearDown()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
if hasattr(cls, "container_name"):
|
||||
cls.delete_containers([cls.container_name])
|
||||
super(AccountQuotasNegativeTest, cls).tearDownClass()
|
||||
super(AccountQuotasNegativeTest, cls).resource_cleanup()
|
||||
|
||||
@test.attr(type=["negative", "smoke"])
|
||||
@test.requires_ext(extension='account_quotas', service='object')
|
||||
|
@ -32,9 +32,8 @@ class AccountTest(base.BaseObjectTest):
|
||||
containers = []
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(AccountTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(AccountTest, cls).resource_setup()
|
||||
for i in moves.xrange(ord('a'), ord('f') + 1):
|
||||
name = data_utils.rand_name(name='%s-' % chr(i))
|
||||
cls.container_client.create_container(name)
|
||||
@ -42,9 +41,9 @@ class AccountTest(base.BaseObjectTest):
|
||||
cls.containers_count = len(cls.containers)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.delete_containers(cls.containers)
|
||||
super(AccountTest, cls).tearDownClass()
|
||||
super(AccountTest, cls).resource_cleanup()
|
||||
|
||||
@test.attr(type='smoke')
|
||||
def test_list_containers(self):
|
||||
|
@ -21,8 +21,8 @@ from tempest import test
|
||||
|
||||
class ObjectTestACLs(base.BaseObjectTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ObjectTestACLs, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectTestACLs, cls).resource_setup()
|
||||
cls.data.setup_test_user()
|
||||
test_os = clients.Manager(cls.data.test_credentials)
|
||||
cls.test_auth_data = test_os.auth_provider.auth_data
|
||||
|
@ -23,8 +23,8 @@ from tempest import test
|
||||
|
||||
class ObjectACLsNegativeTest(base.BaseObjectTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ObjectACLsNegativeTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectACLsNegativeTest, cls).resource_setup()
|
||||
cls.data.setup_test_user()
|
||||
test_os = clients.Manager(cls.data.test_credentials)
|
||||
cls.test_auth_data = test_os.auth_provider.auth_data
|
||||
|
@ -23,9 +23,8 @@ from tempest import test
|
||||
class StaticWebTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(StaticWebTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(StaticWebTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name="TestContainer")
|
||||
|
||||
# This header should be posted on the container before every test
|
||||
@ -45,10 +44,10 @@ class StaticWebTest(base.BaseObjectTest):
|
||||
metadata_prefix="X-Container-")
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
if hasattr(cls, "container_name"):
|
||||
cls.delete_containers([cls.container_name])
|
||||
super(StaticWebTest, cls).tearDownClass()
|
||||
super(StaticWebTest, cls).resource_cleanup()
|
||||
|
||||
@test.requires_ext(extension='staticweb', service='object')
|
||||
@test.attr('gate')
|
||||
|
@ -35,9 +35,8 @@ class ContainerSyncTest(base.BaseObjectTest):
|
||||
clients = {}
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ContainerSyncTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ContainerSyncTest, cls).resource_setup()
|
||||
cls.containers = []
|
||||
cls.objects = []
|
||||
|
||||
@ -62,10 +61,10 @@ class ContainerSyncTest(base.BaseObjectTest):
|
||||
cls.containers.append(cont_name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
for client in cls.clients.values():
|
||||
cls.delete_containers(cls.containers, client[0], client[1])
|
||||
super(ContainerSyncTest, cls).tearDownClass()
|
||||
super(ContainerSyncTest, cls).resource_cleanup()
|
||||
|
||||
@test.attr(type='slow')
|
||||
@test.skip_because(bug='1317133')
|
||||
|
@ -22,8 +22,8 @@ from tempest import test
|
||||
class CrossdomainTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(CrossdomainTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(CrossdomainTest, cls).resource_setup()
|
||||
|
||||
cls.xml_start = '<?xml version="1.0"?>\n' \
|
||||
'<!DOCTYPE cross-domain-policy SYSTEM ' \
|
||||
|
@ -23,8 +23,8 @@ from tempest import test
|
||||
class HealthcheckTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(HealthcheckTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(HealthcheckTest, cls).resource_setup()
|
||||
|
||||
def setUp(self):
|
||||
super(HealthcheckTest, self).setUp()
|
||||
|
@ -23,8 +23,8 @@ from tempest import test
|
||||
|
||||
class ObjectExpiryTest(base.BaseObjectTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ObjectExpiryTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectExpiryTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
|
||||
@ -36,9 +36,9 @@ class ObjectExpiryTest(base.BaseObjectTest):
|
||||
self.object_name, '')
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.delete_containers([cls.container_name])
|
||||
super(ObjectExpiryTest, cls).tearDownClass()
|
||||
super(ObjectExpiryTest, cls).resource_cleanup()
|
||||
|
||||
def _test_object_expiry(self, metadata):
|
||||
# update object metadata
|
||||
|
@ -30,9 +30,8 @@ class ObjectFormPostTest(base.BaseObjectTest):
|
||||
containers = []
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ObjectFormPostTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectFormPostTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.object_name = data_utils.rand_name(name='ObjectTemp')
|
||||
|
||||
@ -56,10 +55,10 @@ class ObjectFormPostTest(base.BaseObjectTest):
|
||||
self.key)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.account_client.delete_account_metadata(metadata=cls.metadata)
|
||||
cls.delete_containers(cls.containers)
|
||||
super(ObjectFormPostTest, cls).tearDownClass()
|
||||
super(ObjectFormPostTest, cls).resource_cleanup()
|
||||
|
||||
def get_multipart_form(self, expires=600):
|
||||
path = "%s/%s/%s" % (
|
||||
|
@ -30,9 +30,8 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest):
|
||||
containers = []
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ObjectFormPostNegativeTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectFormPostNegativeTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.object_name = data_utils.rand_name(name='ObjectTemp')
|
||||
|
||||
@ -56,10 +55,10 @@ class ObjectFormPostNegativeTest(base.BaseObjectTest):
|
||||
self.key)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.account_client.delete_account_metadata(metadata=cls.metadata)
|
||||
cls.delete_containers(cls.containers)
|
||||
super(ObjectFormPostNegativeTest, cls).tearDownClass()
|
||||
super(ObjectFormPostNegativeTest, cls).resource_cleanup()
|
||||
|
||||
def get_multipart_form(self, expires=600):
|
||||
path = "%s/%s/%s" % (
|
||||
|
@ -30,16 +30,16 @@ from tempest import test
|
||||
|
||||
class ObjectTest(base.BaseObjectTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ObjectTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectTest, cls).resource_setup()
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
cls.containers = [cls.container_name]
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.delete_containers(cls.containers)
|
||||
super(ObjectTest, cls).tearDownClass()
|
||||
super(ObjectTest, cls).resource_cleanup()
|
||||
|
||||
def _create_object(self, metadata=None):
|
||||
# setup object
|
||||
|
@ -30,8 +30,8 @@ CONF = config.CONF
|
||||
class ObjectTempUrlTest(base.BaseObjectTest):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ObjectTempUrlTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectTempUrlTest, cls).resource_setup()
|
||||
# create a container
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
@ -52,14 +52,14 @@ class ObjectTempUrlTest(base.BaseObjectTest):
|
||||
cls.object_name, cls.content)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
for metadata in cls.metadatas:
|
||||
cls.account_client.delete_account_metadata(
|
||||
metadata=metadata)
|
||||
|
||||
cls.delete_containers(cls.containers)
|
||||
|
||||
super(ObjectTempUrlTest, cls).tearDownClass()
|
||||
super(ObjectTempUrlTest, cls).resource_cleanup()
|
||||
|
||||
def setUp(self):
|
||||
super(ObjectTempUrlTest, self).setUp()
|
||||
|
@ -31,9 +31,8 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest):
|
||||
containers = []
|
||||
|
||||
@classmethod
|
||||
@test.safe_setup
|
||||
def setUpClass(cls):
|
||||
super(ObjectTempUrlNegativeTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ObjectTempUrlNegativeTest, cls).resource_setup()
|
||||
|
||||
cls.container_name = data_utils.rand_name(name='TestContainer')
|
||||
cls.container_client.create_container(cls.container_name)
|
||||
@ -47,13 +46,13 @@ class ObjectTempUrlNegativeTest(base.BaseObjectTest):
|
||||
cls.account_client.list_account_metadata()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
resp, _ = cls.account_client.delete_account_metadata(
|
||||
metadata=cls.metadata)
|
||||
|
||||
cls.delete_containers(cls.containers)
|
||||
|
||||
super(ObjectTempUrlNegativeTest, cls).tearDownClass()
|
||||
super(ObjectTempUrlNegativeTest, cls).resource_cleanup()
|
||||
|
||||
def setUp(self):
|
||||
super(ObjectTempUrlNegativeTest, self).setUp()
|
||||
|
@ -25,14 +25,14 @@ CONF = config.CONF
|
||||
|
||||
class ContainerTest(base.BaseObjectTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ContainerTest, cls).setUpClass()
|
||||
def resource_setup(cls):
|
||||
super(ContainerTest, cls).resource_setup()
|
||||
cls.containers = []
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
def resource_cleanup(cls):
|
||||
cls.delete_containers(cls.containers)
|
||||
super(ContainerTest, cls).tearDownClass()
|
||||
super(ContainerTest, cls).resource_cleanup()
|
||||
|
||||
def assertContainer(self, container, count, byte, versioned):
|
||||
resp, _ = self.container_client.list_container_metadata(container)
|
||||
|
Loading…
Reference in New Issue
Block a user