From 5f13f71ff2b9a26558792a37e8f4e3a789851939 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Mon, 15 Sep 2014 13:14:54 +0100 Subject: [PATCH] Migrate object_storage API tests to resource_* fixtures Partially-implements bp resource-cleanup Change-Id: If8398052f2bf50694deeb3ac9edf677a51c6fd6c --- tempest/api/object_storage/base.py | 8 ++++---- tempest/api/object_storage/test_account_quotas.py | 9 ++++----- .../api/object_storage/test_account_quotas_negative.py | 9 ++++----- tempest/api/object_storage/test_account_services.py | 9 ++++----- tempest/api/object_storage/test_container_acl.py | 4 ++-- .../api/object_storage/test_container_acl_negative.py | 4 ++-- tempest/api/object_storage/test_container_staticweb.py | 9 ++++----- tempest/api/object_storage/test_container_sync.py | 9 ++++----- tempest/api/object_storage/test_crossdomain.py | 4 ++-- tempest/api/object_storage/test_healthcheck.py | 4 ++-- tempest/api/object_storage/test_object_expiry.py | 8 ++++---- tempest/api/object_storage/test_object_formpost.py | 9 ++++----- .../api/object_storage/test_object_formpost_negative.py | 9 ++++----- tempest/api/object_storage/test_object_services.py | 8 ++++---- tempest/api/object_storage/test_object_temp_url.py | 8 ++++---- .../api/object_storage/test_object_temp_url_negative.py | 9 ++++----- tempest/api/object_storage/test_object_version.py | 8 ++++---- 17 files changed, 60 insertions(+), 68 deletions(-) diff --git a/tempest/api/object_storage/base.py b/tempest/api/object_storage/base.py index a1436595b7..6a5fd3d05e 100644 --- a/tempest/api/object_storage/base.py +++ b/tempest/api/object_storage/base.py @@ -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, diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py index c1eb897ac0..97e9195008 100644 --- a/tempest/api/object_storage/test_account_quotas.py +++ b/tempest/api/object_storage/test_account_quotas.py @@ -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') diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py index 7324c2e418..6c1fb5a517 100644 --- a/tempest/api/object_storage/test_account_quotas_negative.py +++ b/tempest/api/object_storage/test_account_quotas_negative.py @@ -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') diff --git a/tempest/api/object_storage/test_account_services.py b/tempest/api/object_storage/test_account_services.py index 69cba1ed7e..a0436ee62e 100644 --- a/tempest/api/object_storage/test_account_services.py +++ b/tempest/api/object_storage/test_account_services.py @@ -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): diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py index a7d45be6e3..e816a9f409 100644 --- a/tempest/api/object_storage/test_container_acl.py +++ b/tempest/api/object_storage/test_container_acl.py @@ -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 diff --git a/tempest/api/object_storage/test_container_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py index 1a21ecc2b9..9b49db3795 100644 --- a/tempest/api/object_storage/test_container_acl_negative.py +++ b/tempest/api/object_storage/test_container_acl_negative.py @@ -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 diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py index 28bde247db..966a08d8a0 100644 --- a/tempest/api/object_storage/test_container_staticweb.py +++ b/tempest/api/object_storage/test_container_staticweb.py @@ -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') diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py index 3e6d58cc44..aebcb5c49c 100644 --- a/tempest/api/object_storage/test_container_sync.py +++ b/tempest/api/object_storage/test_container_sync.py @@ -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') diff --git a/tempest/api/object_storage/test_crossdomain.py b/tempest/api/object_storage/test_crossdomain.py index ad7e0687e8..f6d1fb9bc3 100644 --- a/tempest/api/object_storage/test_crossdomain.py +++ b/tempest/api/object_storage/test_crossdomain.py @@ -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 = '\n' \ '