Merge "Adding description for testcases - volume part3"

This commit is contained in:
Zuul 2020-09-09 16:41:56 +00:00 committed by Gerrit Code Review
commit fb66ad5594
10 changed files with 156 additions and 32 deletions

View File

@ -20,6 +20,7 @@ from tempest.lib import decorators
class BackendsCapabilitiesAdminTestsJSON(base.BaseVolumeAdminTest):
"""Test backends capabilities"""
@classmethod
def resource_setup(cls):
@ -32,14 +33,16 @@ class BackendsCapabilitiesAdminTestsJSON(base.BaseVolumeAdminTest):
@decorators.idempotent_id('3750af44-5ea2-4cd4-bc3e-56e7e6caf854')
def test_get_capabilities_backend(self):
# Test backend properties
"""Test getting backend capabilities"""
# Check response schema
self.admin_capabilities_client.show_backend_capabilities(self.hosts[0])
@decorators.idempotent_id('a9035743-d46a-47c5-9cb7-3c80ea16dea0')
def test_compare_volume_stats_values(self):
# Test values comparison between show_backend_capabilities
# to show_pools
"""Test comparing volume stats values
Compare volume stats between show_backend_capabilities and show_pools.
"""
VOLUME_STATS = ('vendor_name',
'volume_backend_name',
'storage_protocol')

View File

@ -62,12 +62,26 @@ class BaseGroupSnapshotsTest(base.BaseVolumeAdminTest):
class GroupSnapshotsTest(BaseGroupSnapshotsTest):
"""Test group snapshot"""
_api_version = 3
min_microversion = '3.14'
max_microversion = 'latest'
@decorators.idempotent_id('1298e537-f1f0-47a3-a1dd-8adec8168897')
def test_group_snapshot_create_show_list_delete(self):
"""Test create/show/list/delete group snapshot
1. Create volume type "volume_type1"
2. Create group type "group_type1"
3. Create group "group1" with "group_type1" and "volume_type1"
4. Create volume "volume1" with "volume_type1" and "group1"
5. Create group snapshot "group_snapshot1" with "group1"
6. Check snapshot created from "volume1" reaches available status
7. Check the created group snapshot "group_snapshot1" is in the list
of all group snapshots
8. Delete group snapshot "group_snapshot1"
"""
# Create volume type
volume_type = self.create_volume_type()
@ -118,6 +132,18 @@ class GroupSnapshotsTest(BaseGroupSnapshotsTest):
@decorators.idempotent_id('eff52c70-efc7-45ed-b47a-4ad675d09b81')
def test_create_group_from_group_snapshot(self):
"""Test creating group from group snapshot
1. Create volume type "volume_type1"
2. Create group type "group_type1"
3. Create group "group1" with "group_type1" and "volume_type1"
4. Create volume "volume1" with "volume_type1" and "group1"
5. Create group snapshot "group_snapshot1" with "group1"
6. Check snapshot created from "volume1" reaches available status
7. Create group "group2" from "group_snapshot1"
8. Check the volumes belonging to "group2" reach available status
9. Check "group2" reaches available status
"""
# Create volume type
volume_type = self.create_volume_type()
@ -161,6 +187,20 @@ class GroupSnapshotsTest(BaseGroupSnapshotsTest):
@decorators.idempotent_id('7d7fc000-0b4c-4376-a372-544116d2e127')
@decorators.related_bug('1739031')
def test_delete_group_snapshots_following_updated_volumes(self):
"""Test deleting group snapshot following updated volumes
1. Create volume type "volume_type1"
2. Create group type "group_type1"
3. Create group "group1" with "group_type1" and "volume_type1"
4. Create 2 volumes "volume1" and "volume2"
with "volume_type1" and "group1"
5. For each created volume, removing and then adding back to "group1"
6. Create group snapshot "group_snapshot1" with "group1"
7. Check snapshots created from "volume1" and "volume2" reach
available status
8. Delete "group_snapshot1"
9. Check snapshots created from "volume1" and "volume2" are deleted
"""
volume_type = self.create_volume_type()
group_type = self.create_group_type()
@ -211,6 +251,8 @@ class GroupSnapshotsTest(BaseGroupSnapshotsTest):
class GroupSnapshotsV319Test(BaseGroupSnapshotsTest):
"""Test group snapshot with volume microversion greater than 3.18"""
_api_version = 3
min_microversion = '3.19'
max_microversion = 'latest'
@ -218,6 +260,7 @@ class GroupSnapshotsV319Test(BaseGroupSnapshotsTest):
@decorators.idempotent_id('3b42c9b9-c984-4444-816e-ca2e1ed30b40')
@decorators.skip_because(bug='1770179')
def test_reset_group_snapshot_status(self):
"""Test resetting group snapshot status to creating/available/error"""
# Create volume type
volume_type = self.create_volume_type()

View File

@ -19,12 +19,15 @@ from tempest.lib import exceptions as lib_exc
class GroupTypeSpecsTest(base.BaseVolumeAdminTest):
"""Test group type specs"""
_api_version = 3
min_microversion = '3.11'
max_microversion = 'latest'
@decorators.idempotent_id('bb4e30d0-de6e-4f4d-866c-dcc48d023b4e')
def test_group_type_specs_create_show_update_list_delete(self):
"""Test create/show/update/list/delete group type specs"""
# Create new group type
group_type = self.create_group_type()

View File

@ -19,13 +19,15 @@ from tempest.lib import decorators
class GroupTypesTest(base.BaseVolumeAdminTest):
"""Test group types"""
_api_version = 3
min_microversion = '3.11'
max_microversion = 'latest'
@decorators.idempotent_id('dd71e5f9-393e-4d4f-90e9-fa1b8d278864')
def test_group_type_create_list_update_show(self):
# Create/list/show group type.
"""Test create/list/update/show group type"""
name = data_utils.rand_name(self.__class__.__name__ + '-group-type')
description = data_utils.rand_name("group-type-description")
group_specs = {"consistent_group_snapshot_enabled": "<is> False"}

View File

@ -21,6 +21,7 @@ CONF = config.CONF
class VolumeMultiBackendTest(base.BaseVolumeAdminTest):
"""Test volume multi backends"""
@classmethod
def skip_checks(cls):
@ -78,24 +79,49 @@ class VolumeMultiBackendTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('c1a41f3f-9dad-493e-9f09-3ff197d477cc')
def test_backend_name_reporting(self):
# get volume id which created by type without prefix
"""Test backend name reporting for volume when type is without prefix
1. Create volume type, with 'volume_backend_name' as extra spec key
2. Create volume using the created volume type
3. Check 'os-vol-host-attr:host' of the volume info, the value should
contain '@' character, like 'cinder@CloveStorage#tecs_backend'
"""
for volume_id in self.volume_id_list_without_prefix:
self._test_backend_name_reporting_by_volume_id(volume_id)
@decorators.idempotent_id('f38e647f-ab42-4a31-a2e7-ca86a6485215')
def test_backend_name_reporting_with_prefix(self):
# get volume id which created by type with prefix
"""Test backend name reporting for volume when type is with prefix
1. Create volume type, with 'capabilities:volume_backend_name' as
extra spec key
2. Create volume using the created volume type
3. Check 'os-vol-host-attr:host' of the volume info, the value should
contain '@' character, like 'cinder@CloveStorage#tecs_backend'
"""
for volume_id in self.volume_id_list_with_prefix:
self._test_backend_name_reporting_by_volume_id(volume_id)
@decorators.idempotent_id('46435ab1-a0af-4401-8373-f14e66b0dd58')
def test_backend_name_distinction(self):
# get volume ids which created by type without prefix
"""Test volume backend distinction when type is without prefix
1. For each backend, create volume type with 'volume_backend_name'
as extra spec key
2. Create volumes using the created volume types
3. Check 'os-vol-host-attr:host' of each created volume is different.
"""
self._test_backend_name_distinction(self.volume_id_list_without_prefix)
@decorators.idempotent_id('4236305b-b65a-4bfc-a9d2-69cb5b2bf2ed')
def test_backend_name_distinction_with_prefix(self):
# get volume ids which created by type without prefix
"""Test volume backend distinction when type is with prefix
1. For each backend, create volume type with
'capabilities:volume_backend_name' as extra spec key
2. Create volumes using the created volume types
3. Check 'os-vol-host-attr:host' of each created volume is different.
"""
self._test_backend_name_distinction(self.volume_id_list_with_prefix)
def _get_volume_host(self, volume_id):

View File

@ -22,6 +22,8 @@ CONF = config.CONF
class SnapshotsActionsTest(base.BaseVolumeAdminTest):
"""Test volume snapshot actions"""
@classmethod
def skip_checks(cls):
super(SnapshotsActionsTest, cls).skip_checks()
@ -65,7 +67,7 @@ class SnapshotsActionsTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('3e13ca2f-48ea-49f3-ae1a-488e9180d535')
def test_reset_snapshot_status(self):
# Reset snapshot status to creating
"""Test resetting snapshot status to creating"""
status = 'creating'
self.admin_snapshots_client.reset_snapshot_status(
self.snapshot['id'], status)
@ -74,6 +76,10 @@ class SnapshotsActionsTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('41288afd-d463-485e-8f6e-4eea159413eb')
def test_update_snapshot_status(self):
"""Test updating snapshot
Update snapshot status to 'error' and progress to '80%'.
"""
# Reset snapshot status to creating
status = 'creating'
self.admin_snapshots_client.reset_snapshot_status(
@ -95,20 +101,20 @@ class SnapshotsActionsTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('05f711b6-e629-4895-8103-7ca069f2073a')
def test_snapshot_force_delete_when_snapshot_is_creating(self):
# test force delete when status of snapshot is creating
"""Test force delete when status of snapshot is creating"""
self._create_reset_and_force_delete_temp_snapshot('creating')
@decorators.idempotent_id('92ce8597-b992-43a1-8868-6316b22a969e')
def test_snapshot_force_delete_when_snapshot_is_deleting(self):
# test force delete when status of snapshot is deleting
"""Test force delete when status of snapshot is deleting"""
self._create_reset_and_force_delete_temp_snapshot('deleting')
@decorators.idempotent_id('645a4a67-a1eb-4e8e-a547-600abac1525d')
def test_snapshot_force_delete_when_snapshot_is_error(self):
# test force delete when status of snapshot is error
"""Test force delete when status of snapshot is error"""
self._create_reset_and_force_delete_temp_snapshot('error')
@decorators.idempotent_id('bf89080f-8129-465e-9327-b2f922666ba5')
def test_snapshot_force_delete_when_snapshot_is_error_deleting(self):
# test force delete when status of snapshot is error_deleting
"""Test force delete when status of snapshot is error_deleting"""
self._create_reset_and_force_delete_temp_snapshot('error_deleting')

View File

@ -30,6 +30,7 @@ QUOTA_KEYS = ['gigabytes', 'snapshots', 'volumes', 'backups',
class VolumeQuotaClassesTest(base.BaseVolumeAdminTest):
"""Test volume quota classes"""
def setUp(self):
# Note(jeremy.zhang): All test cases in this class need to externally
@ -44,6 +45,7 @@ class VolumeQuotaClassesTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('abb9198e-67d0-4b09-859f-4f4a1418f176')
def test_show_default_quota(self):
"""Test showing default volume quota class set"""
# response body is validated by schema
default_quotas = self.admin_quota_classes_client.show_quota_class_set(
'default')['quota_class_set']
@ -51,6 +53,11 @@ class VolumeQuotaClassesTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('a7644c63-2669-467a-b00e-452dd5c5397b')
def test_update_default_quota(self):
"""Test updating default volume quota class set
Check current project and new project's default quota are updated
to the provided one.
"""
LOG.debug("Get the current default quota class values")
body = self.admin_quota_classes_client.show_quota_class_set(
'default')['quota_class_set']

View File

@ -23,17 +23,18 @@ CONF = config.CONF
class VolumeTypesTest(base.BaseVolumeAdminTest):
"""Test volume types"""
@decorators.idempotent_id('9d9b28e3-1b2e-4483-a2cc-24aa0ea1de54')
def test_volume_type_list(self):
# List volume types.
"""Test listing volume types"""
body = \
self.admin_volume_types_client.list_volume_types()['volume_types']
self.assertIsInstance(body, list)
@decorators.idempotent_id('c03cc62c-f4e9-4623-91ec-64ce2f9c1260')
def test_volume_crud_with_volume_type_and_extra_specs(self):
# Create/update/get/delete volume with volume_type and extra spec.
"""Test create/update/get/delete volume with volume_type"""
volume_types = list()
vol_name = data_utils.rand_name(self.__class__.__name__ + '-volume')
proto = CONF.volume.storage_protocol
@ -80,7 +81,7 @@ class VolumeTypesTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('4e955c3b-49db-4515-9590-0c99f8e471ad')
def test_volume_type_create_get_delete(self):
# Create/get volume type.
"""Test create/get/delete volume type"""
name = data_utils.rand_name(self.__class__.__name__ + '-volume-type')
description = data_utils.rand_name("volume-type-description")
proto = CONF.volume.storage_protocol
@ -118,7 +119,7 @@ class VolumeTypesTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('7830abd0-ff99-4793-a265-405684a54d46')
def test_volume_type_encryption_create_get_update_delete(self):
# Create/get/update/delete encryption type.
"""Test create/get/update/delete volume encryption type"""
create_kwargs = {'provider': 'LuksEncryptor',
'control_location': 'front-end'}
volume_type_id = self.create_volume_type()['id']
@ -175,6 +176,7 @@ class VolumeTypesTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('cf9f07c6-db9e-4462-a243-5933ad65e9c8')
def test_volume_type_update(self):
"""Test updating volume type details"""
# Create volume type
volume_type = self.create_volume_type()

View File

@ -20,6 +20,7 @@ from tempest.lib import exceptions as lib_exc
class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
"""Negative tests of volume type extra specs"""
@classmethod
def resource_setup(cls):
@ -30,7 +31,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('08961d20-5cbb-4910-ac0f-89ad6dbb2da1')
def test_update_no_body(self):
# Should not update volume type extra specs with no body
"""Test updating volume type extra specs with no body should fail"""
self.assertRaises(
lib_exc.BadRequest,
self.admin_volume_types_client.update_volume_type_extra_specs,
@ -39,7 +40,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('25e5a0ee-89b3-4c53-8310-236f76c75365')
def test_update_nonexistent_extra_spec_id(self):
# Should not update volume type extra specs with nonexistent id.
"""Test updating volume type extra specs with non existent name
Updating volume type extra specs with non existent extra spec name
should fail.
"""
extra_spec = {"spec1": "val2"}
self.assertRaises(
lib_exc.BadRequest,
@ -50,7 +55,10 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9bf7a657-b011-4aec-866d-81c496fbe5c8')
def test_update_none_extra_spec_id(self):
# Should not update volume type extra specs with none id.
"""Test updating volume type extra specs without name
Updating volume type extra specs without extra spec name should fail.
"""
extra_spec = {"spec1": "val2"}
self.assertRaises(
lib_exc.BadRequest,
@ -60,8 +68,7 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a77dfda2-9100-448e-9076-ed1711f4bdfc')
def test_update_multiple_extra_spec(self):
# Should not update volume type extra specs with multiple specs as
# body.
"""Test updating multiple volume type extra specs should fail"""
extra_spec = {"spec1": "val2", "spec2": "val1"}
self.assertRaises(
lib_exc.BadRequest,
@ -72,8 +79,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('49d5472c-a53d-4eab-a4d3-450c4db1c545')
def test_create_nonexistent_type_id(self):
# Should not create volume type extra spec for nonexistent volume
# type id.
"""Test creating volume type extra specs for non existent volume type
Creating volume type extra specs for non existent volume type should
fail.
"""
extra_specs = {"spec2": "val1"}
self.assertRaises(
lib_exc.NotFound,
@ -83,7 +93,10 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c821bdc8-43a4-4bf4-86c8-82f3858d5f7d')
def test_create_none_body(self):
# Should not create volume type extra spec for none POST body.
"""Test creating volume type extra spec with none POST body
Creating volume type extra spec with none POST body should fail.
"""
self.assertRaises(
lib_exc.BadRequest,
self.admin_volume_types_client.create_volume_type_extra_specs,
@ -92,7 +105,10 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('bc772c71-1ed4-4716-b945-8b5ed0f15e87')
def test_create_invalid_body(self):
# Should not create volume type extra spec for invalid POST body.
"""Test creating volume type extra spec with invalid POST body
Creating volume type extra spec with invalid POST body should fail.
"""
self.assertRaises(
lib_exc.BadRequest,
self.admin_volume_types_client.create_volume_type_extra_specs,
@ -101,8 +117,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('031cda8b-7d23-4246-8bf6-bbe73fd67074')
def test_delete_nonexistent_volume_type_id(self):
# Should not delete volume type extra spec for nonexistent
# type id.
"""Test deleting volume type extra spec for non existent volume type
Deleting volume type extra spec for non existent volume type should
fail.
"""
self.assertRaises(
lib_exc.NotFound,
self.admin_volume_types_client.delete_volume_type_extra_specs,
@ -111,7 +130,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('dee5cf0c-cdd6-4353-b70c-e847050d71fb')
def test_list_nonexistent_volume_type_id(self):
# Should not list volume type extra spec for nonexistent type id.
"""Test listing volume type extra spec for non existent volume type
Listing volume type extra spec for non existent volume type should
fail.
"""
self.assertRaises(
lib_exc.NotFound,
self.admin_volume_types_client.list_volume_types_extra_specs,
@ -120,7 +143,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9f402cbd-1838-4eb4-9554-126a6b1908c9')
def test_get_nonexistent_volume_type_id(self):
# Should not get volume type extra spec for nonexistent type id.
"""Test getting volume type extra spec for non existent volume type
Getting volume type extra spec for non existent volume type should
fail.
"""
self.assertRaises(
lib_exc.NotFound,
self.admin_volume_types_client.show_volume_type_extra_specs,
@ -129,8 +156,11 @@ class ExtraSpecsNegativeTest(base.BaseVolumeAdminTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c881797d-12ff-4f1a-b09d-9f6212159753')
def test_get_nonexistent_extra_spec_name(self):
# Should not get volume type extra spec for nonexistent extra spec
# name.
"""Test getting volume type extra spec for non existent spec name
Getting volume type extra spec for non existent extra spec name should
fail.
"""
self.assertRaises(
lib_exc.NotFound,
self.admin_volume_types_client.show_volume_type_extra_specs,

View File

@ -26,6 +26,7 @@ CONF = config.CONF
class VolumesBackupsAdminTest(base.BaseVolumeAdminTest):
"""Test volume backups"""
@classmethod
def skip_checks(cls):
@ -118,6 +119,7 @@ class VolumesBackupsAdminTest(base.BaseVolumeAdminTest):
@decorators.idempotent_id('47a35425-a891-4e13-961c-c45deea21e94')
def test_volume_backup_reset_status(self):
"""Test resetting volume backup status to error"""
# Create a volume
volume = self.create_volume()
# Create a backup