Merge "Migrate image API tests to resource_* fixtures"
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index c875b2f..08767e3 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -31,9 +31,9 @@
"""Base test class for Image API tests."""
@classmethod
- def setUpClass(cls):
+ def resource_setup(cls):
cls.set_network_resources()
- super(BaseImageTest, cls).setUpClass()
+ super(BaseImageTest, cls).resource_setup()
cls.created_images = []
cls._interface = 'json'
cls.isolated_creds = isolated_creds.IsolatedCreds(
@@ -47,7 +47,7 @@
cls.os = clients.Manager()
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for image_id in cls.created_images:
try:
cls.client.delete_image(image_id)
@@ -57,7 +57,7 @@
for image_id in cls.created_images:
cls.client.wait_for_resource_deletion(image_id)
cls.isolated_creds.clear_isolated_creds()
- super(BaseImageTest, cls).tearDownClass()
+ super(BaseImageTest, cls).resource_cleanup()
@classmethod
def create_image(cls, **kwargs):
@@ -79,8 +79,8 @@
class BaseV1ImageTest(BaseImageTest):
@classmethod
- def setUpClass(cls):
- super(BaseV1ImageTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseV1ImageTest, cls).resource_setup()
cls.client = cls.os.image_client
if not CONF.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
@@ -89,8 +89,8 @@
class BaseV1ImageMembersTest(BaseV1ImageTest):
@classmethod
- def setUpClass(cls):
- super(BaseV1ImageMembersTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseV1ImageMembersTest, cls).resource_setup()
if CONF.compute.allow_tenant_isolation:
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
else:
@@ -113,8 +113,8 @@
class BaseV2ImageTest(BaseImageTest):
@classmethod
- def setUpClass(cls):
- super(BaseV2ImageTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseV2ImageTest, cls).resource_setup()
cls.client = cls.os.image_client_v2
if not CONF.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
@@ -124,8 +124,8 @@
class BaseV2MemberImageTest(BaseV2ImageTest):
@classmethod
- def setUpClass(cls):
- super(BaseV2MemberImageTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(BaseV2MemberImageTest, cls).resource_setup()
if CONF.compute.allow_tenant_isolation:
creds = cls.isolated_creds.get_alt_creds()
cls.os_alt = clients.Manager(creds)
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index bf55b89..38a623a 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -106,9 +106,8 @@
"""
@classmethod
- @test.safe_setup
- def setUpClass(cls):
- super(ListImagesTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(ListImagesTest, cls).resource_setup()
# We add a few images here to test the listing functionality of
# the images API
img1 = cls._create_remote_image('one', 'bare', 'raw')
@@ -235,8 +234,7 @@
class ListSnapshotImagesTest(base.BaseV1ImageTest):
@classmethod
- @test.safe_setup
- def setUpClass(cls):
+ def resource_setup(cls):
# This test class only uses nova v3 api to create snapshot
# as the similar test which uses nova v2 api already exists
# in nova v2 compute images api tests.
@@ -246,7 +244,7 @@
skip_msg = ("%s skipped as nova v3 api is not available" %
cls.__name__)
raise cls.skipException(skip_msg)
- super(ListSnapshotImagesTest, cls).setUpClass()
+ super(ListSnapshotImagesTest, cls).resource_setup()
cls.servers_client = cls.os.servers_v3_client
cls.servers = []
# We add a few images here to test the listing functionality of
@@ -265,10 +263,10 @@
cls.client.wait_for_image_status(image['id'], 'active')
@classmethod
- def tearDownClass(cls):
+ def resource_cleanup(cls):
for server in getattr(cls, "servers", []):
cls.servers_client.delete_server(server['id'])
- super(ListSnapshotImagesTest, cls).tearDownClass()
+ super(ListSnapshotImagesTest, cls).resource_cleanup()
@classmethod
def _create_snapshot(cls, name, image_id, flavor, **kwargs):
@@ -329,8 +327,8 @@
class UpdateImageMetaTest(base.BaseV1ImageTest):
@classmethod
- def setUpClass(cls):
- super(UpdateImageMetaTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(UpdateImageMetaTest, cls).resource_setup()
cls.image_id = cls._create_standard_image('1', 'ami', 'ami', 42)
@classmethod
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index a974ebb..7e018e5 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -125,9 +125,8 @@
"""
@classmethod
- @test.safe_setup
- def setUpClass(cls):
- super(ListImagesTest, cls).setUpClass()
+ def resource_setup(cls):
+ super(ListImagesTest, cls).resource_setup()
# We add a few images here to test the listing functionality of
# the images API
cls._create_standard_image('bare', 'raw')