Merge "Adding description for testcases - volume part5"
This commit is contained in:
commit
a6ab1841f3
|
@ -22,6 +22,8 @@ QUOTA_KEYS = ['gigabytes', 'snapshots', 'volumes', 'backups',
|
|||
|
||||
|
||||
class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
||||
"""Test volume quotas with admin privilege"""
|
||||
|
||||
credentials = ['primary', 'alt', 'admin']
|
||||
|
||||
def setUp(self):
|
||||
|
@ -54,17 +56,19 @@ class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
|||
|
||||
@decorators.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
|
||||
def test_list_quotas(self):
|
||||
"""Test showing volume quota set"""
|
||||
# Check response schema
|
||||
self.admin_quotas_client.show_quota_set(self.demo_tenant_id)
|
||||
|
||||
@decorators.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')
|
||||
def test_list_default_quotas(self):
|
||||
"""Test showing volume default quota set"""
|
||||
# Check response schema
|
||||
self.admin_quotas_client.show_default_quota_set(self.demo_tenant_id)
|
||||
|
||||
@decorators.idempotent_id('3d45c99e-cc42-4424-a56e-5cbd212b63a6')
|
||||
def test_update_all_quota_resources_for_tenant(self):
|
||||
# Admin can update all the resource quota limits for a tenant
|
||||
"""Test admin can update all the volume quota limits for a project"""
|
||||
new_quota_set = {'gigabytes': 1009,
|
||||
'volumes': 11,
|
||||
'snapshots': 11,
|
||||
|
@ -87,14 +91,14 @@ class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
|||
|
||||
@decorators.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
|
||||
def test_show_quota_usage(self):
|
||||
"""Test showing volume quota usage"""
|
||||
# Check response schema
|
||||
self.admin_quotas_client.show_quota_set(
|
||||
self.os_admin.credentials.tenant_id, params={'usage': True})
|
||||
|
||||
@decorators.idempotent_id('874b35a9-51f1-4258-bec5-cd561b6690d3')
|
||||
def test_delete_quota(self):
|
||||
# Admin can delete the resource quota set for a project
|
||||
|
||||
"""Test admin can delete the volume quota set for a project"""
|
||||
self.addCleanup(self.admin_quotas_client.update_quota_set,
|
||||
self.demo_tenant_id, **self.cleanup_quota_set)
|
||||
|
||||
|
@ -112,6 +116,7 @@ class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
|||
|
||||
@decorators.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')
|
||||
def test_quota_usage(self):
|
||||
"""Test volume quota usage is updated after creating volume"""
|
||||
quota_usage = self.admin_quotas_client.show_quota_set(
|
||||
self.demo_tenant_id, params={'usage': True})['quota_set']
|
||||
|
||||
|
@ -131,6 +136,7 @@ class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
|
|||
|
||||
@decorators.idempotent_id('8911036f-9d54-4720-80cc-a1c9796a8805')
|
||||
def test_quota_usage_after_volume_transfer(self):
|
||||
"""Test volume quota usage is updated after transferring volume"""
|
||||
# Create a volume for transfer
|
||||
volume = self.create_volume()
|
||||
self.addCleanup(self.delete_volume,
|
||||
|
|
|
@ -88,6 +88,7 @@ class VolumeRetypeTest(base.BaseVolumeAdminTest):
|
|||
|
||||
|
||||
class VolumeRetypeWithMigrationTest(VolumeRetypeTest):
|
||||
"""Test volume retype with migration"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
|
@ -134,11 +135,25 @@ class VolumeRetypeWithMigrationTest(VolumeRetypeTest):
|
|||
|
||||
@decorators.idempotent_id('a1a41f3f-9dad-493e-9f09-3ff197d477cd')
|
||||
def test_available_volume_retype_with_migration(self):
|
||||
"""Test volume retype with migration
|
||||
|
||||
1. Create volume1 with volume_type1
|
||||
2. Retype volume1 to volume_type2 with migration_policy='on-demand'
|
||||
3. Check volume1's volume_type is changed to volume_type2, and
|
||||
'os-vol-host-attr:host' in the volume info is changed.
|
||||
"""
|
||||
src_vol = self.create_volume(volume_type=self.src_vol_type['name'])
|
||||
self._retype_volume(src_vol, migration_policy='on-demand')
|
||||
|
||||
@decorators.idempotent_id('d0d9554f-e7a5-4104-8973-f35b27ccb60d')
|
||||
def test_volume_from_snapshot_retype_with_migration(self):
|
||||
"""Test volume created from snapshot retype with migration
|
||||
|
||||
1. Create volume1 from snapshot with volume_type1
|
||||
2. Retype volume1 to volume_type2 with migration_policy='on-demand'
|
||||
3. Check volume1's volume_type is changed to volume_type2, and
|
||||
'os-vol-host-attr:host' in the volume info is changed.
|
||||
"""
|
||||
src_vol = self._create_volume_from_snapshot()
|
||||
|
||||
# Migrate the volume from snapshot to the second backend
|
||||
|
@ -146,6 +161,7 @@ class VolumeRetypeWithMigrationTest(VolumeRetypeTest):
|
|||
|
||||
|
||||
class VolumeRetypeWithoutMigrationTest(VolumeRetypeTest):
|
||||
"""Test volume retype without migration"""
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
|
@ -174,6 +190,13 @@ class VolumeRetypeWithoutMigrationTest(VolumeRetypeTest):
|
|||
|
||||
@decorators.idempotent_id('b90412ee-465d-46e9-b249-ec84a47d5f25')
|
||||
def test_available_volume_retype(self):
|
||||
"""Test volume retype without migration
|
||||
|
||||
1. Create volume1 with volume_type1
|
||||
2. Retype volume1 to volume_type2 with migration_policy='never'
|
||||
3. Check volume1's volume_type is changed to volume_type2, and
|
||||
'os-vol-host-attr:host' in the volume info is not changed.
|
||||
"""
|
||||
src_vol = self.create_volume(volume_type=self.src_vol_type['name'])
|
||||
|
||||
# Retype the volume from snapshot
|
||||
|
|
|
@ -19,6 +19,7 @@ from tempest.lib import exceptions as lib_exc
|
|||
|
||||
|
||||
class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
||||
"""Negative tests of volume services"""
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
|
@ -30,6 +31,7 @@ class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('3246ce65-ba70-4159-aa3b-082c28e4b484')
|
||||
def test_enable_service_with_invalid_host(self):
|
||||
"""Test enabling volume service with invalid host should fail"""
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.admin_volume_services_client.enable_service,
|
||||
host='invalid_host', binary=self.binary)
|
||||
|
@ -37,6 +39,7 @@ class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('c571f179-c6e6-4c50-a0ab-368b628a8ac1')
|
||||
def test_disable_service_with_invalid_binary(self):
|
||||
"""Test disabling volume service with invalid binary should fail"""
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.admin_volume_services_client.disable_service,
|
||||
host=self.host, binary='invalid_binary')
|
||||
|
@ -44,6 +47,7 @@ class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('77767b36-5e8f-4c68-a0b5-2308cc21ec64')
|
||||
def test_disable_log_reason_with_no_reason(self):
|
||||
"""Test disabling volume service with none reason should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.admin_volume_services_client.disable_log_reason,
|
||||
host=self.host, binary=self.binary,
|
||||
|
@ -52,6 +56,7 @@ class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('712bfab8-1f44-4eb5-a632-fa70bf78f05e')
|
||||
def test_freeze_host_with_invalid_host(self):
|
||||
"""Test freezing volume service with invalid host should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.admin_volume_services_client.freeze_host,
|
||||
host='invalid_host')
|
||||
|
@ -59,6 +64,7 @@ class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('7c6287c9-d655-47e1-9a11-76f6657a6dce')
|
||||
def test_thaw_host_with_invalid_host(self):
|
||||
"""Test thawing volume service with invalid host should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.admin_volume_services_client.thaw_host,
|
||||
host='invalid_host')
|
||||
|
|
|
@ -24,6 +24,7 @@ QUOTA_KEYS = ['gigabytes', 'snapshots', 'volumes', 'backups',
|
|||
|
||||
|
||||
class VolumeSnapshotQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
|
||||
"""Negative tests of volume snapshot quotas"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
|
@ -67,6 +68,7 @@ class VolumeSnapshotQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('02bbf63f-6c05-4357-9d98-2926a94064ff')
|
||||
def test_quota_volume_snapshots(self):
|
||||
"""Test creating snapshot exceeding snapshots quota should fail"""
|
||||
self.assertRaises(lib_exc.OverLimit,
|
||||
self.snapshots_client.create_snapshot,
|
||||
volume_id=self.volume['id'])
|
||||
|
@ -74,6 +76,7 @@ class VolumeSnapshotQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
|
|||
@decorators.attr(type='negative')
|
||||
@decorators.idempotent_id('c99a1ca9-6cdf-498d-9fdf-25832babef27')
|
||||
def test_quota_volume_gigabytes_snapshots(self):
|
||||
"""Test creating snapshot exceeding gigabytes quota should fail"""
|
||||
self.addCleanup(self.admin_quotas_client.update_quota_set,
|
||||
self.demo_tenant_id,
|
||||
**self.shared_quota_set)
|
||||
|
|
|
@ -17,14 +17,14 @@ from tempest.lib import decorators
|
|||
|
||||
|
||||
class VersionsTest(base.BaseVolumeTest):
|
||||
"""Test cinder versions"""
|
||||
"""Test volume versions"""
|
||||
|
||||
_api_version = 3
|
||||
|
||||
@decorators.idempotent_id('77838fc4-b49b-4c64-9533-166762517369')
|
||||
@decorators.attr(type='smoke')
|
||||
def test_list_versions(self):
|
||||
"""Test listing cinder versions"""
|
||||
"""Test listing volume versions"""
|
||||
# NOTE: The version data is checked on service client side
|
||||
# with JSON-Schema validation. It is enough to just call
|
||||
# the API here.
|
||||
|
@ -32,7 +32,7 @@ class VersionsTest(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('7f755ae2-caa9-4049-988c-331d8f7a579f')
|
||||
def test_show_version(self):
|
||||
"Test getting cinder version details"
|
||||
"""Test getting volume version details"""
|
||||
# NOTE: The version data is checked on service client side
|
||||
# with JSON-Schema validation. So we will loop through each
|
||||
# version and call show version.
|
||||
|
|
|
@ -24,6 +24,7 @@ CONF = config.CONF
|
|||
# it requires force_tenant_isolation=True, which need admin
|
||||
# credentials to create non-admin users for the tests.
|
||||
class AbsoluteLimitsTests(base.BaseVolumeAdminTest): # noqa: T115
|
||||
"""Test volume absolute limits"""
|
||||
|
||||
# avoid existing volumes of pre-defined tenant
|
||||
force_tenant_isolation = True
|
||||
|
@ -43,7 +44,7 @@ class AbsoluteLimitsTests(base.BaseVolumeAdminTest): # noqa: T115
|
|||
|
||||
@decorators.idempotent_id('8e943f53-e9d6-4272-b2e9-adcf2f7c29ad')
|
||||
def test_get_volume_absolute_limits(self):
|
||||
# get volume limit for a tenant
|
||||
"""Test getting volume absolute limits"""
|
||||
absolute_limits = \
|
||||
self.volume_limits_client.show_limits(
|
||||
)['limits']['absolute']
|
||||
|
|
|
@ -27,6 +27,7 @@ CONF = config.CONF
|
|||
|
||||
|
||||
class VolumesBackupsTest(base.BaseVolumeTest):
|
||||
"""Test volumes backup"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
|
@ -54,6 +55,16 @@ class VolumesBackupsTest(base.BaseVolumeTest):
|
|||
'ceph does not support arbitrary container names')
|
||||
@decorators.idempotent_id('a66eb488-8ee1-47d4-8e9f-575a095728c6')
|
||||
def test_volume_backup_create_get_detailed_list_restore_delete(self):
|
||||
"""Test create/get/list/restore/delete volume backup
|
||||
|
||||
1. Create volume1 with metadata
|
||||
2. Create backup1 from volume1
|
||||
3. Show backup1
|
||||
4. List backups with detail
|
||||
5. Restore backup1
|
||||
6. Verify backup1 has been restored successfully with the metadata
|
||||
of volume1
|
||||
"""
|
||||
# Create a volume with metadata
|
||||
metadata = {"vol-meta1": "value1",
|
||||
"vol-meta2": "value2",
|
||||
|
@ -89,7 +100,7 @@ class VolumesBackupsTest(base.BaseVolumeTest):
|
|||
restored_volume_metadata = self.volumes_client.show_volume(
|
||||
restored_volume['volume_id'])['volume']['metadata']
|
||||
|
||||
# Verify the backups has been restored successfully
|
||||
# Verify the backup has been restored successfully
|
||||
# with the metadata of the source volume.
|
||||
self.assertThat(restored_volume_metadata.items(),
|
||||
matchers.ContainsAll(metadata.items()))
|
||||
|
@ -120,6 +131,13 @@ class VolumesBackupsTest(base.BaseVolumeTest):
|
|||
@decorators.idempotent_id('2a8ba340-dff2-4511-9db7-646f07156b15')
|
||||
@utils.services('image')
|
||||
def test_bootable_volume_backup_and_restore(self):
|
||||
"""Test backuping and restoring a bootable volume
|
||||
|
||||
1. Create volume1 from image
|
||||
2. Create backup1 from volume1
|
||||
3. Restore backup1
|
||||
4. Verify the restored backup volume is bootable
|
||||
"""
|
||||
# Create volume from image
|
||||
img_uuid = CONF.compute.image_ref
|
||||
volume = self.create_volume(imageRef=img_uuid)
|
||||
|
@ -144,6 +162,7 @@ class VolumesBackupsTest(base.BaseVolumeTest):
|
|||
|
||||
|
||||
class VolumesBackupsV39Test(base.BaseVolumeTest):
|
||||
"""Test volumes backup with volume microversion greater than 3.8"""
|
||||
|
||||
_api_version = 3
|
||||
min_microversion = '3.9'
|
||||
|
@ -157,6 +176,7 @@ class VolumesBackupsV39Test(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('9b374cbc-be5f-4d37-8848-7efb8a873dcc')
|
||||
def test_update_backup(self):
|
||||
"""Test updating backup's name and description"""
|
||||
# Create volume and backup
|
||||
volume = self.create_volume()
|
||||
backup = self.create_backup(volume_id=volume['id'])
|
||||
|
|
|
@ -25,6 +25,8 @@ CONF = config.CONF
|
|||
|
||||
|
||||
class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
||||
"""Test volume snapshots"""
|
||||
|
||||
create_default_network = True
|
||||
|
||||
@classmethod
|
||||
|
@ -41,6 +43,7 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
|||
@decorators.idempotent_id('8567b54c-4455-446d-a1cf-651ddeaa3ff2')
|
||||
@utils.services('compute')
|
||||
def test_snapshot_create_delete_with_volume_in_use(self):
|
||||
"""Test create/delete snapshot from volume attached to server"""
|
||||
# Create a test instance
|
||||
server = self.create_server()
|
||||
# NOTE(zhufl) Here we create volume from self.image_ref for adding
|
||||
|
@ -66,7 +69,13 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
|||
@decorators.idempotent_id('5210a1de-85a0-11e6-bb21-641c676a5d61')
|
||||
@utils.services('compute')
|
||||
def test_snapshot_create_offline_delete_online(self):
|
||||
"""Test creating snapshots when volume is detached and attached
|
||||
|
||||
1. Create snapshot1 from volume1(not attached to any server)
|
||||
2. Attach volume1 to server1
|
||||
3. Create snapshot2 and snapshot3 from volume1
|
||||
4. Delete snapshot3, snapshot1, snapshot2
|
||||
"""
|
||||
# Create a snapshot while it is not attached
|
||||
snapshot1 = self.create_snapshot(self.volume_origin['id'])
|
||||
|
||||
|
@ -74,7 +83,7 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
|||
server = self.create_server()
|
||||
self.attach_volume(server['id'], self.volume_origin['id'])
|
||||
|
||||
# Now that the volume is attached, create another snapshots
|
||||
# Now that the volume is attached, create other snapshots
|
||||
snapshot2 = self.create_snapshot(self.volume_origin['id'], force=True)
|
||||
snapshot3 = self.create_snapshot(self.volume_origin['id'], force=True)
|
||||
|
||||
|
@ -86,6 +95,7 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('2a8abbe4-d871-46db-b049-c41f5af8216e')
|
||||
def test_snapshot_create_get_list_update_delete(self):
|
||||
"""Test create/get/list/update/delete snapshot"""
|
||||
# Create a snapshot with metadata
|
||||
metadata = {"snap-meta1": "value1",
|
||||
"snap-meta2": "value2",
|
||||
|
@ -156,19 +166,25 @@ class VolumesSnapshotTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('677863d1-3142-456d-b6ac-9924f667a7f4')
|
||||
def test_volume_from_snapshot(self):
|
||||
# Creates a volume from a snapshot passing a size
|
||||
# different from the source
|
||||
"""Test creating volume from snapshot with extending size"""
|
||||
self._create_volume_from_snapshot(extra_size=1)
|
||||
|
||||
@decorators.idempotent_id('053d8870-8282-4fff-9dbb-99cb58bb5e0a')
|
||||
def test_volume_from_snapshot_no_size(self):
|
||||
# Creates a volume from a snapshot defaulting to original size
|
||||
"""Test creating volume from snapshot with original size"""
|
||||
self._create_volume_from_snapshot()
|
||||
|
||||
@decorators.idempotent_id('bbcfa285-af7f-479e-8c1a-8c34fc16543c')
|
||||
@testtools.skipUnless(CONF.volume_feature_enabled.backup,
|
||||
"Cinder backup is disabled")
|
||||
def test_snapshot_backup(self):
|
||||
"""Test creating backup from snapshot and volume
|
||||
|
||||
1. Create snapshot1 from volume1
|
||||
2. Create backup from volume1 and snapshot1
|
||||
3. Check the created backup's volume is volume1 and snapshot
|
||||
is snapshot1
|
||||
"""
|
||||
# Create a snapshot
|
||||
snapshot = self.create_snapshot(volume_id=self.volume_origin['id'])
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ CONF = config.CONF
|
|||
|
||||
|
||||
class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
||||
"""Test listing volume snapshots"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
|
@ -50,6 +51,7 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
def _list_snapshots_by_param_limit(self, limit, expected_elements):
|
||||
"""list snapshots by limit param"""
|
||||
|
||||
# Get snapshots list using limit parameter
|
||||
fetched_snap_list = self.snapshots_client.list_snapshots(
|
||||
limit=limit)['snapshots']
|
||||
|
@ -58,7 +60,8 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('59f41f43-aebf-48a9-ab5d-d76340fab32b')
|
||||
def test_snapshots_list_with_params(self):
|
||||
"""list snapshots with params."""
|
||||
"""Test listing snapshots with params"""
|
||||
|
||||
# Verify list snapshots by display_name filter
|
||||
params = {'name': self.snapshot['name']}
|
||||
self._list_by_param_values_and_assert(**params)
|
||||
|
@ -74,7 +77,8 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('220a1022-1fcd-4a74-a7bd-6b859156cda2')
|
||||
def test_snapshots_list_details_with_params(self):
|
||||
"""list snapshot details with params."""
|
||||
"""Test listing snapshot details with params"""
|
||||
|
||||
# Verify list snapshot details by display_name filter
|
||||
params = {'name': self.snapshot['name']}
|
||||
self._list_by_param_values_and_assert(with_detail=True, **params)
|
||||
|
@ -88,24 +92,29 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('db4d8e0a-7a2e-41cc-a712-961f6844e896')
|
||||
def test_snapshot_list_param_limit(self):
|
||||
# List returns limited elements
|
||||
"""Test listing snapshot with limit returns the limited elements
|
||||
|
||||
If listing snapshots with limit=1, then 1 snapshot is returned.
|
||||
"""
|
||||
self._list_snapshots_by_param_limit(limit=1, expected_elements=1)
|
||||
|
||||
@decorators.idempotent_id('a1427f61-420e-48a5-b6e3-0b394fa95400')
|
||||
def test_snapshot_list_param_limit_equals_infinite(self):
|
||||
# List returns all elements when request limit exceeded
|
||||
# snapshots number
|
||||
"""Test listing snapshot with infinite limit
|
||||
|
||||
If listing snapshots with limit greater than the count of all
|
||||
snapshots, then all snapshots are returned.
|
||||
"""
|
||||
snap_list = self.snapshots_client.list_snapshots()['snapshots']
|
||||
self._list_snapshots_by_param_limit(limit=100000,
|
||||
expected_elements=len(snap_list))
|
||||
|
||||
@decorators.idempotent_id('e3b44b7f-ae87-45b5-8a8c-66110eb24d0a')
|
||||
def test_snapshot_list_param_limit_equals_zero(self):
|
||||
# List returns zero elements
|
||||
"""Test listing snapshot with zero limit should return empty list"""
|
||||
self._list_snapshots_by_param_limit(limit=0, expected_elements=0)
|
||||
|
||||
def _list_snapshots_param_sort(self, sort_key, sort_dir):
|
||||
"""list snapshots by sort param"""
|
||||
snap_list = self.snapshots_client.list_snapshots(
|
||||
sort_key=sort_key, sort_dir=sort_dir)['snapshots']
|
||||
self.assertNotEmpty(snap_list)
|
||||
|
@ -122,33 +131,42 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('c5513ada-64c1-4d28-83b9-af3307ec1388')
|
||||
def test_snapshot_list_param_sort_id_asc(self):
|
||||
"""Test listing snapshots sort by id ascendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='id', sort_dir='asc')
|
||||
|
||||
@decorators.idempotent_id('8a7fe058-0b41-402a-8afd-2dbc5a4a718b')
|
||||
def test_snapshot_list_param_sort_id_desc(self):
|
||||
"""Test listing snapshots sort by id descendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='id', sort_dir='desc')
|
||||
|
||||
@decorators.idempotent_id('4052c3a0-2415-440a-a8cc-305a875331b0')
|
||||
def test_snapshot_list_param_sort_created_at_asc(self):
|
||||
"""Test listing snapshots sort by created_at ascendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='created_at', sort_dir='asc')
|
||||
|
||||
@decorators.idempotent_id('dcbbe24a-f3c0-4ec8-9274-55d48db8d1cf')
|
||||
def test_snapshot_list_param_sort_created_at_desc(self):
|
||||
"""Test listing snapshots sort by created_at descendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='created_at', sort_dir='desc')
|
||||
|
||||
@decorators.idempotent_id('d58b5fed-0c37-42d3-8c5d-39014ac13c00')
|
||||
def test_snapshot_list_param_sort_name_asc(self):
|
||||
"""Test listing snapshots sort by display_name ascendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='display_name',
|
||||
sort_dir='asc')
|
||||
|
||||
@decorators.idempotent_id('96ba6f4d-1f18-47e1-b4bc-76edc6c21250')
|
||||
def test_snapshot_list_param_sort_name_desc(self):
|
||||
"""Test listing snapshots sort by display_name descendingly"""
|
||||
self._list_snapshots_param_sort(sort_key='display_name',
|
||||
sort_dir='desc')
|
||||
|
||||
@decorators.idempotent_id('05489dde-44bc-4961-a1f5-3ce7ee7824f7')
|
||||
def test_snapshot_list_param_marker(self):
|
||||
# The list of snapshots should end before the provided marker
|
||||
"""Test listing snapshots with marker
|
||||
|
||||
The list of snapshots should end before the provided marker
|
||||
"""
|
||||
snap_list = self.snapshots_client.list_snapshots()['snapshots']
|
||||
# list_snapshots will take the reverse order as they are created.
|
||||
snapshot_id_list = [snap['id'] for snap in snap_list][::-1]
|
||||
|
@ -163,6 +181,13 @@ class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
|
|||
|
||||
@decorators.idempotent_id('ca96d551-17c6-4e11-b0e8-52d3bb8a63c7')
|
||||
def test_snapshot_list_param_offset(self):
|
||||
"""Test listing snapshots with offset and limit
|
||||
|
||||
If listing snapshots with offset=2 and limit=3, then at most 3(limit)
|
||||
snapshots located in the position 2(offset) in the all snapshots list
|
||||
should be returned.
|
||||
(The items in the all snapshots list start from position 0.)
|
||||
"""
|
||||
params = {'offset': 2, 'limit': 3}
|
||||
snap_list = self.snapshots_client.list_snapshots(**params)['snapshots']
|
||||
# Verify the list of snapshots skip offset=2 from the first element
|
||||
|
|
|
@ -20,6 +20,7 @@ CONF = config.CONF
|
|||
|
||||
|
||||
class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
||||
"""Negative tests of volume snapshot"""
|
||||
|
||||
@classmethod
|
||||
def skip_checks(cls):
|
||||
|
@ -30,7 +31,7 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('e3e466af-70ab-4f4b-a967-ab04e3532ea7')
|
||||
def test_create_snapshot_with_nonexistent_volume_id(self):
|
||||
# Create a snapshot with nonexistent volume id
|
||||
"""Test creating snapshot from non existent volume should fail"""
|
||||
s_name = data_utils.rand_name(self.__class__.__name__ + '-snap')
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.snapshots_client.create_snapshot,
|
||||
|
@ -40,6 +41,7 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('bb9da53e-d335-4309-9c15-7e76fd5e4d6d')
|
||||
def test_create_snapshot_without_passing_volume_id(self):
|
||||
"""Test creating snapshot without passing volume_id should fail"""
|
||||
# Create a snapshot without passing volume id
|
||||
s_name = data_utils.rand_name(self.__class__.__name__ + '-snap')
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
|
@ -49,6 +51,10 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('677863d1-34f9-456d-b6ac-9924f667a7f4')
|
||||
def test_volume_from_snapshot_decreasing_size(self):
|
||||
"""Test creating volume from snapshot with decreasing size
|
||||
|
||||
creating volume from snapshot with decreasing size should fail.
|
||||
"""
|
||||
# Creates a volume a snapshot passing a size different from the source
|
||||
src_size = CONF.volume.volume_size * 2
|
||||
|
||||
|
@ -64,6 +70,7 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('8fd92339-e22f-4591-86b4-1e2215372a40')
|
||||
def test_list_snapshot_invalid_param_limit(self):
|
||||
"""Test listing snapshots with invalid limit param should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.snapshots_client.list_snapshots,
|
||||
limit='invalid')
|
||||
|
@ -71,6 +78,7 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('27b5f37f-bf69-4e8c-986e-c44f3d6819b8')
|
||||
def test_list_snapshots_invalid_param_sort(self):
|
||||
"""Test listing snapshots with invalid sort key should fail"""
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.snapshots_client.list_snapshots,
|
||||
sort_key='invalid')
|
||||
|
@ -78,6 +86,7 @@ class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
|
|||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('b68deeda-ca79-4a32-81af-5c51179e553a')
|
||||
def test_list_snapshots_invalid_param_marker(self):
|
||||
"""Test listing snapshots with invalid marker should fail"""
|
||||
self.assertRaises(lib_exc.NotFound,
|
||||
self.snapshots_client.list_snapshots,
|
||||
marker=data_utils.rand_uuid())
|
||||
|
|
Loading…
Reference in New Issue