Split resource_setup for object_storage tests
Split up the resource_setup method for all the object_storage tests, as per the
latest spec.
Partially-implements bp:resource-cleanup
Change-Id: I1a1ba8d240fcb4bad0964c56749ca016aad0dbfa
diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py
index 79a1960..6a025d9 100644
--- a/tempest/api/object_storage/base.py
+++ b/tempest/api/object_storage/base.py
@@ -28,21 +28,31 @@
class BaseObjectTest(tempest.test.BaseTestCase):
@classmethod
- def resource_setup(cls):
- cls.set_network_resources()
- super(BaseObjectTest, cls).resource_setup()
+ def skip_checks(cls):
+ super(BaseObjectTest, cls).skip_checks()
if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" % cls.__name__)
raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ cls.set_network_resources()
+ super(BaseObjectTest, cls).setup_credentials()
+
cls.isolated_creds = credentials.get_isolated_credentials(
cls.__name__, network_resources=cls.network_resources)
# Get isolated creds for normal user
cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
# Get isolated creds for admin user
cls.os_admin = clients.Manager(cls.isolated_creds.get_admin_creds())
+ cls.data = SwiftDataGenerator(cls.os_admin.identity_client)
# Get isolated creds for alt user
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+ @classmethod
+ def setup_clients(cls):
+ super(BaseObjectTest, cls).setup_clients()
+
cls.object_client = cls.os.object_client
cls.container_client = cls.os.container_client
cls.account_client = cls.os.account_client
@@ -52,6 +62,10 @@
cls.container_client_alt = cls.os_alt.container_client
cls.identity_client_alt = cls.os_alt.identity_client
+ @classmethod
+ def resource_setup(cls):
+ super(BaseObjectTest, cls).resource_setup()
+
# Make sure we get fresh auth data after assigning swift role
cls.object_client.auth_provider.clear_auth()
cls.container_client.auth_provider.clear_auth()
@@ -59,8 +73,6 @@
cls.object_client_alt.auth_provider.clear_auth()
cls.container_client_alt.auth_provider.clear_auth()
- cls.data = SwiftDataGenerator(cls.identity_admin_client)
-
@classmethod
def resource_cleanup(cls):
cls.data.teardown_all()
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 1832b37..e3f5f3d 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -26,15 +26,17 @@
class AccountQuotasTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
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)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index 0e136bf..783bf1a 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -29,15 +29,17 @@
class AccountQuotasNegativeTest(base.BaseObjectTest):
@classmethod
+ def setup_credentials(cls):
+ super(AccountQuotasNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user(reseller=True)
+ cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
+
+ @classmethod
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)
- cls.data.setup_test_user(reseller=True)
-
- cls.os_reselleradmin = clients.Manager(cls.data.test_credentials)
-
# Retrieve a ResellerAdmin auth data and use it to set a quota
# on the client's account
cls.reselleradmin_auth_data = \
diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py
index 205bc91..44763a1 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -20,12 +20,17 @@
class ObjectTestACLs(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectTestACLs, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
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
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectTestACLs, self).setUp()
diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 7fe472c..edc052e 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -23,12 +23,17 @@
class ObjectACLsNegativeTest(base.BaseObjectTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(ObjectACLsNegativeTest, cls).setup_credentials()
+ cls.data.setup_test_user()
+ cls.test_os = clients.Manager(cls.data.test_credentials)
+
@classmethod
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
+ cls.test_auth_data = cls.test_os.auth_provider.auth_data
def setUp(self):
super(ObjectACLsNegativeTest, self).setUp()
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
index 53c0347..6fbd77b 100644
--- a/tempest/api/object_storage/test_healthcheck.py
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -22,10 +22,6 @@
class HealthcheckTest(base.BaseObjectTest):
- @classmethod
- def resource_setup(cls):
- super(HealthcheckTest, cls).resource_setup()
-
def setUp(self):
super(HealthcheckTest, self).setUp()
# Turning http://.../v1/foobar into http://.../