Merge "Migrate image API tests to resource_* fixtures"
This commit is contained in:
commit
f7b138c257
@ -31,9 +31,9 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
||||
"""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 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
||||
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 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
||||
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 BaseImageTest(tempest.test.BaseTestCase):
|
||||
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 BaseV1ImageTest(BaseImageTest):
|
||||
|
||||
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 BaseV1ImageMembersTest(BaseV1ImageTest):
|
||||
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 BaseV2ImageTest(BaseImageTest):
|
||||
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)
|
||||
|
@ -106,9 +106,8 @@ class ListImagesTest(base.BaseV1ImageTest):
|
||||
"""
|
||||
|
||||
@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 ListImagesTest(base.BaseV1ImageTest):
|
||||
|
||||
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 @@ class ListSnapshotImagesTest(base.BaseV1ImageTest):
|
||||
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 @@ class ListSnapshotImagesTest(base.BaseV1ImageTest):
|
||||
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 ListSnapshotImagesTest(base.BaseV1ImageTest):
|
||||
|
||||
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
|
||||
|
@ -125,9 +125,8 @@ class ListImagesTest(base.BaseV2ImageTest):
|
||||
"""
|
||||
|
||||
@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')
|
||||
|
Loading…
Reference in New Issue
Block a user