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."""
|
"""Base test class for Image API tests."""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
cls.set_network_resources()
|
cls.set_network_resources()
|
||||||
super(BaseImageTest, cls).setUpClass()
|
super(BaseImageTest, cls).resource_setup()
|
||||||
cls.created_images = []
|
cls.created_images = []
|
||||||
cls._interface = 'json'
|
cls._interface = 'json'
|
||||||
cls.isolated_creds = isolated_creds.IsolatedCreds(
|
cls.isolated_creds = isolated_creds.IsolatedCreds(
|
||||||
@ -47,7 +47,7 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
|||||||
cls.os = clients.Manager()
|
cls.os = clients.Manager()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def resource_cleanup(cls):
|
||||||
for image_id in cls.created_images:
|
for image_id in cls.created_images:
|
||||||
try:
|
try:
|
||||||
cls.client.delete_image(image_id)
|
cls.client.delete_image(image_id)
|
||||||
@ -57,7 +57,7 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
|||||||
for image_id in cls.created_images:
|
for image_id in cls.created_images:
|
||||||
cls.client.wait_for_resource_deletion(image_id)
|
cls.client.wait_for_resource_deletion(image_id)
|
||||||
cls.isolated_creds.clear_isolated_creds()
|
cls.isolated_creds.clear_isolated_creds()
|
||||||
super(BaseImageTest, cls).tearDownClass()
|
super(BaseImageTest, cls).resource_cleanup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_image(cls, **kwargs):
|
def create_image(cls, **kwargs):
|
||||||
@ -79,8 +79,8 @@ class BaseImageTest(tempest.test.BaseTestCase):
|
|||||||
class BaseV1ImageTest(BaseImageTest):
|
class BaseV1ImageTest(BaseImageTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
super(BaseV1ImageTest, cls).setUpClass()
|
super(BaseV1ImageTest, cls).resource_setup()
|
||||||
cls.client = cls.os.image_client
|
cls.client = cls.os.image_client
|
||||||
if not CONF.image_feature_enabled.api_v1:
|
if not CONF.image_feature_enabled.api_v1:
|
||||||
msg = "Glance API v1 not supported"
|
msg = "Glance API v1 not supported"
|
||||||
@ -89,8 +89,8 @@ class BaseV1ImageTest(BaseImageTest):
|
|||||||
|
|
||||||
class BaseV1ImageMembersTest(BaseV1ImageTest):
|
class BaseV1ImageMembersTest(BaseV1ImageTest):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
super(BaseV1ImageMembersTest, cls).setUpClass()
|
super(BaseV1ImageMembersTest, cls).resource_setup()
|
||||||
if CONF.compute.allow_tenant_isolation:
|
if CONF.compute.allow_tenant_isolation:
|
||||||
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
|
cls.os_alt = clients.Manager(cls.isolated_creds.get_alt_creds())
|
||||||
else:
|
else:
|
||||||
@ -113,8 +113,8 @@ class BaseV1ImageMembersTest(BaseV1ImageTest):
|
|||||||
class BaseV2ImageTest(BaseImageTest):
|
class BaseV2ImageTest(BaseImageTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
super(BaseV2ImageTest, cls).setUpClass()
|
super(BaseV2ImageTest, cls).resource_setup()
|
||||||
cls.client = cls.os.image_client_v2
|
cls.client = cls.os.image_client_v2
|
||||||
if not CONF.image_feature_enabled.api_v2:
|
if not CONF.image_feature_enabled.api_v2:
|
||||||
msg = "Glance API v2 not supported"
|
msg = "Glance API v2 not supported"
|
||||||
@ -124,8 +124,8 @@ class BaseV2ImageTest(BaseImageTest):
|
|||||||
class BaseV2MemberImageTest(BaseV2ImageTest):
|
class BaseV2MemberImageTest(BaseV2ImageTest):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
super(BaseV2MemberImageTest, cls).setUpClass()
|
super(BaseV2MemberImageTest, cls).resource_setup()
|
||||||
if CONF.compute.allow_tenant_isolation:
|
if CONF.compute.allow_tenant_isolation:
|
||||||
creds = cls.isolated_creds.get_alt_creds()
|
creds = cls.isolated_creds.get_alt_creds()
|
||||||
cls.os_alt = clients.Manager(creds)
|
cls.os_alt = clients.Manager(creds)
|
||||||
|
@ -106,9 +106,8 @@ class ListImagesTest(base.BaseV1ImageTest):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@test.safe_setup
|
def resource_setup(cls):
|
||||||
def setUpClass(cls):
|
super(ListImagesTest, cls).resource_setup()
|
||||||
super(ListImagesTest, cls).setUpClass()
|
|
||||||
# We add a few images here to test the listing functionality of
|
# We add a few images here to test the listing functionality of
|
||||||
# the images API
|
# the images API
|
||||||
img1 = cls._create_remote_image('one', 'bare', 'raw')
|
img1 = cls._create_remote_image('one', 'bare', 'raw')
|
||||||
@ -235,8 +234,7 @@ class ListImagesTest(base.BaseV1ImageTest):
|
|||||||
|
|
||||||
class ListSnapshotImagesTest(base.BaseV1ImageTest):
|
class ListSnapshotImagesTest(base.BaseV1ImageTest):
|
||||||
@classmethod
|
@classmethod
|
||||||
@test.safe_setup
|
def resource_setup(cls):
|
||||||
def setUpClass(cls):
|
|
||||||
# This test class only uses nova v3 api to create snapshot
|
# This test class only uses nova v3 api to create snapshot
|
||||||
# as the similar test which uses nova v2 api already exists
|
# as the similar test which uses nova v2 api already exists
|
||||||
# in nova v2 compute images api tests.
|
# 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" %
|
skip_msg = ("%s skipped as nova v3 api is not available" %
|
||||||
cls.__name__)
|
cls.__name__)
|
||||||
raise cls.skipException(skip_msg)
|
raise cls.skipException(skip_msg)
|
||||||
super(ListSnapshotImagesTest, cls).setUpClass()
|
super(ListSnapshotImagesTest, cls).resource_setup()
|
||||||
cls.servers_client = cls.os.servers_v3_client
|
cls.servers_client = cls.os.servers_v3_client
|
||||||
cls.servers = []
|
cls.servers = []
|
||||||
# We add a few images here to test the listing functionality of
|
# 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')
|
cls.client.wait_for_image_status(image['id'], 'active')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def resource_cleanup(cls):
|
||||||
for server in getattr(cls, "servers", []):
|
for server in getattr(cls, "servers", []):
|
||||||
cls.servers_client.delete_server(server['id'])
|
cls.servers_client.delete_server(server['id'])
|
||||||
super(ListSnapshotImagesTest, cls).tearDownClass()
|
super(ListSnapshotImagesTest, cls).resource_cleanup()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _create_snapshot(cls, name, image_id, flavor, **kwargs):
|
def _create_snapshot(cls, name, image_id, flavor, **kwargs):
|
||||||
@ -329,8 +327,8 @@ class ListSnapshotImagesTest(base.BaseV1ImageTest):
|
|||||||
|
|
||||||
class UpdateImageMetaTest(base.BaseV1ImageTest):
|
class UpdateImageMetaTest(base.BaseV1ImageTest):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def resource_setup(cls):
|
||||||
super(UpdateImageMetaTest, cls).setUpClass()
|
super(UpdateImageMetaTest, cls).resource_setup()
|
||||||
cls.image_id = cls._create_standard_image('1', 'ami', 'ami', 42)
|
cls.image_id = cls._create_standard_image('1', 'ami', 'ami', 42)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -125,9 +125,8 @@ class ListImagesTest(base.BaseV2ImageTest):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@test.safe_setup
|
def resource_setup(cls):
|
||||||
def setUpClass(cls):
|
super(ListImagesTest, cls).resource_setup()
|
||||||
super(ListImagesTest, cls).setUpClass()
|
|
||||||
# We add a few images here to test the listing functionality of
|
# We add a few images here to test the listing functionality of
|
||||||
# the images API
|
# the images API
|
||||||
cls._create_standard_image('bare', 'raw')
|
cls._create_standard_image('bare', 'raw')
|
||||||
|
Loading…
Reference in New Issue
Block a user