Split resource_setup for image tests
Split up the resource_setup method for all the image tests, as per the
latest spec.
Partially-implements bp:resource-cleanup
Change-Id: I9cae905e8191e650bd0ae24c09926fc04f957edf
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 344742b..ffc3071 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -31,16 +31,24 @@
"""Base test class for Image API tests."""
@classmethod
+ def skip_checks(cls):
+ super(BaseImageTest, cls).skip_checks()
+ if not CONF.service_available.glance:
+ skip_msg = ("%s skipped as glance is not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseImageTest, cls).setup_credentials()
+ cls.isolated_creds = credentials.get_isolated_credentials(
+ cls.__name__, network_resources=cls.network_resources)
+ cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
+
+ @classmethod
def resource_setup(cls):
cls.set_network_resources()
super(BaseImageTest, cls).resource_setup()
cls.created_images = []
- cls.isolated_creds = credentials.get_isolated_credentials(
- cls.__name__, network_resources=cls.network_resources)
- if not CONF.service_available.glance:
- skip_msg = ("%s skipped as glance is not available" % cls.__name__)
- raise cls.skipException(skip_msg)
- cls.os = clients.Manager(cls.isolated_creds.get_primary_creds())
@classmethod
def resource_cleanup(cls):
@@ -75,21 +83,33 @@
class BaseV1ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV1ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client
+ def skip_checks(cls):
+ super(BaseV1ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v1:
msg = "Glance API v1 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client
+
class BaseV1ImageMembersTest(BaseV1ImageTest):
+
+ @classmethod
+ def setup_credentials(cls):
+ super(BaseV1ImageMembersTest, cls).setup_credentials()
+ cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV1ImageMembersTest, cls).setup_clients()
+ cls.alt_img_cli = cls.os_alt.image_client
+
@classmethod
def resource_setup(cls):
super(BaseV1ImageMembersTest, cls).resource_setup()
- cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
-
- cls.alt_img_cli = cls.os_alt.image_client
cls.alt_tenant_id = cls.alt_img_cli.tenant_id
def _create_image(self):
@@ -105,23 +125,35 @@
class BaseV2ImageTest(BaseImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2ImageTest, cls).resource_setup()
- cls.client = cls.os.image_client_v2
+ def skip_checks(cls):
+ super(BaseV2ImageTest, cls).skip_checks()
if not CONF.image_feature_enabled.api_v2:
msg = "Glance API v2 not supported"
raise cls.skipException(msg)
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2ImageTest, cls).setup_clients()
+ cls.client = cls.os.image_client_v2
+
class BaseV2MemberImageTest(BaseV2ImageTest):
@classmethod
- def resource_setup(cls):
- super(BaseV2MemberImageTest, cls).resource_setup()
+ def setup_credentials(cls):
+ super(BaseV2MemberImageTest, cls).setup_credentials()
creds = cls.isolated_creds.get_alt_creds()
cls.os_alt = clients.Manager(creds)
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseV2MemberImageTest, cls).setup_clients()
cls.os_img_client = cls.os.image_client_v2
cls.alt_img_client = cls.os_alt.image_client_v2
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseV2MemberImageTest, cls).resource_setup()
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):