From fcfb31bccb7d63f8095103f06e27a8ff2394f6c8 Mon Sep 17 00:00:00 2001 From: zhufl Date: Mon, 20 Apr 2020 15:41:07 +0800 Subject: [PATCH] Adding description for testcases - volume part2 When Tempest is used in customer site, often we are required to provide a testcase list including testcase names and descriptions. Now no this kind of doc is available, so we can add descriptions with the format of doc string for every testcase, so later we can generata such a testcase description list. There are hundreds of testcases missing descriptions, so we can add them gradually, and limit the modified files in one patch for the convenience of reviewing. Change-Id: I8577ceddcc99f77cfa091519d1466f075de54e43 partially-implements: blueprint testcase-description --- tempest/api/volume/admin/test_groups.py | 10 ++++++++++ tempest/api/volume/admin/test_snapshot_manage.py | 1 + tempest/api/volume/admin/test_user_messages.py | 4 ++++ tempest/api/volume/admin/test_volume_hosts.py | 3 +++ tempest/api/volume/admin/test_volume_manage.py | 2 ++ tempest/api/volume/admin/test_volume_pools.py | 4 ++++ .../volume/admin/test_volume_quotas_negative.py | 4 ++++ .../volume/admin/test_volume_types_negative.py | 9 +++++---- tempest/api/volume/admin/test_volumes_actions.py | 16 +++++++++++----- 9 files changed, 44 insertions(+), 9 deletions(-) diff --git a/tempest/api/volume/admin/test_groups.py b/tempest/api/volume/admin/test_groups.py index 2f6eb6b535..e67b985f02 100644 --- a/tempest/api/volume/admin/test_groups.py +++ b/tempest/api/volume/admin/test_groups.py @@ -23,12 +23,15 @@ CONF = config.CONF class GroupsTest(base.BaseVolumeAdminTest): + """Tests of volume groups with microversion greater than 3.12""" + _api_version = 3 min_microversion = '3.13' max_microversion = 'latest' @decorators.idempotent_id('4b111d28-b73d-4908-9bd2-03dc2992e4d4') def test_group_create_show_list_delete(self): + """Test creating, showing, listing and deleting of volume group""" # Create volume type volume_type = self.create_volume_type() @@ -95,6 +98,7 @@ class GroupsTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('4a8a6fd2-8b3b-4641-8f54-6a6f99320006') def test_group_update(self): + """Test updating volume group""" # Create volume type volume_type = self.create_volume_type() @@ -150,12 +154,15 @@ class GroupsTest(base.BaseVolumeAdminTest): class GroupsV314Test(base.BaseVolumeAdminTest): + """Tests of volume groups with microversion greater than 3.13""" + _api_version = 3 min_microversion = '3.14' max_microversion = 'latest' @decorators.idempotent_id('2424af8c-7851-4888-986a-794b10c3210e') def test_create_group_from_group(self): + """Test creating volume group from volume group""" # Create volume type volume_type = self.create_volume_type() @@ -185,12 +192,15 @@ class GroupsV314Test(base.BaseVolumeAdminTest): class GroupsV320Test(base.BaseVolumeAdminTest): + """Tests of volume groups with microversion greater than 3.19""" + _api_version = 3 min_microversion = '3.20' max_microversion = 'latest' @decorators.idempotent_id('b20c696b-0cbc-49a5-8b3a-b1fb9338f45c') def test_reset_group_status(self): + """Test resetting volume group status to creating/available/error""" # Create volume type volume_type = self.create_volume_type() diff --git a/tempest/api/volume/admin/test_snapshot_manage.py b/tempest/api/volume/admin/test_snapshot_manage.py index 37a47ec293..ab0aa383a2 100644 --- a/tempest/api/volume/admin/test_snapshot_manage.py +++ b/tempest/api/volume/admin/test_snapshot_manage.py @@ -48,6 +48,7 @@ class SnapshotManageAdminTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('0132f42d-0147-4b45-8501-cc504bbf7810') def test_unmanage_manage_snapshot(self): + """Test unmanaging and managing volume snapshot""" # Create a volume volume = self.create_volume() diff --git a/tempest/api/volume/admin/test_user_messages.py b/tempest/api/volume/admin/test_user_messages.py index 8048017717..096709c901 100644 --- a/tempest/api/volume/admin/test_user_messages.py +++ b/tempest/api/volume/admin/test_user_messages.py @@ -22,6 +22,8 @@ CONF = config.CONF class UserMessagesTest(base.BaseVolumeAdminTest): + """Test volume messages with microversion greater than 3.2""" + _api_version = 3 min_microversion = '3.3' max_microversion = 'latest' @@ -51,6 +53,7 @@ class UserMessagesTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('50f29e6e-f363-42e1-8ad1-f67ae7fd4d5a') def test_list_show_messages(self): + """Test listing and showing volume messages""" message_id = self._create_user_message() self.addCleanup(self.messages_client.delete_message, message_id) @@ -62,6 +65,7 @@ class UserMessagesTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('c6eb6901-cdcc-490f-b735-4fe251842aed') def test_delete_message(self): + """Test deleting volume messages""" message_id = self._create_user_message() self.messages_client.delete_message(message_id) self.messages_client.wait_for_resource_deletion(message_id) diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py index 83c27e1a33..e4e15c5b38 100644 --- a/tempest/api/volume/admin/test_volume_hosts.py +++ b/tempest/api/volume/admin/test_volume_hosts.py @@ -18,9 +18,11 @@ from tempest.lib import decorators class VolumeHostsAdminTestsJSON(base.BaseVolumeAdminTest): + """Test fetching volume hosts info by admin users""" @decorators.idempotent_id('d5f3efa2-6684-4190-9ced-1c2f526352ad') def test_list_hosts(self): + """Test listing volume hosts""" hosts = self.admin_hosts_client.list_hosts()['hosts'] self.assertGreaterEqual(len(hosts), 2, "The count of volume hosts is < 2, " @@ -28,6 +30,7 @@ class VolumeHostsAdminTestsJSON(base.BaseVolumeAdminTest): @decorators.idempotent_id('21168d57-b373-4b71-a3ac-f2c88f0c5d31') def test_show_host(self): + """Test getting volume host details""" hosts = self.admin_hosts_client.list_hosts()['hosts'] self.assertGreaterEqual(len(hosts), 2, "The count of volume hosts is < 2, " diff --git a/tempest/api/volume/admin/test_volume_manage.py b/tempest/api/volume/admin/test_volume_manage.py index 4b352e0c51..1e4e7cb35c 100644 --- a/tempest/api/volume/admin/test_volume_manage.py +++ b/tempest/api/volume/admin/test_volume_manage.py @@ -24,6 +24,7 @@ CONF = config.CONF class VolumeManageAdminTest(base.BaseVolumeAdminTest): + """Test volume manage by admin users""" @classmethod def skip_checks(cls): @@ -39,6 +40,7 @@ class VolumeManageAdminTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('70076c71-0ce1-4208-a8ff-36a66e65cc1e') def test_unmanage_manage_volume(self): + """Test unmanaging and managing volume""" # Create original volume org_vol_id = self.create_volume()['id'] org_vol_info = self.admin_volume_client.show_volume( diff --git a/tempest/api/volume/admin/test_volume_pools.py b/tempest/api/volume/admin/test_volume_pools.py index 744bc01b1c..942499476f 100644 --- a/tempest/api/volume/admin/test_volume_pools.py +++ b/tempest/api/volume/admin/test_volume_pools.py @@ -21,6 +21,8 @@ CONF = config.CONF class VolumePoolsAdminTestsJSON(base.BaseVolumeAdminTest): + """Test getting volume pools by admin users""" + def _assert_pools(self, with_detail=False): cinder_pools = self.admin_scheduler_stats_client.list_pools( detail=with_detail)['pools'] @@ -33,8 +35,10 @@ class VolumePoolsAdminTestsJSON(base.BaseVolumeAdminTest): @decorators.idempotent_id('0248a46c-e226-4933-be10-ad6fca8227e7') def test_get_pools_without_details(self): + """Test getting volume pools without detail""" self._assert_pools() @decorators.idempotent_id('d4bb61f7-762d-4437-b8a4-5785759a0ced') def test_get_pools_with_details(self): + """Test getting volume pools with detail""" self._assert_pools(with_detail=True) diff --git a/tempest/api/volume/admin/test_volume_quotas_negative.py b/tempest/api/volume/admin/test_volume_quotas_negative.py index 5c7ab150c2..937d28b8ac 100644 --- a/tempest/api/volume/admin/test_volume_quotas_negative.py +++ b/tempest/api/volume/admin/test_volume_quotas_negative.py @@ -24,6 +24,7 @@ QUOTA_KEYS = ['gigabytes', 'snapshots', 'volumes', 'backups', class VolumeQuotasNegativeTestJSON(base.BaseVolumeAdminTest): + """Negative tests of volume quotas""" @classmethod def setup_credentials(cls): @@ -52,6 +53,7 @@ class VolumeQuotasNegativeTestJSON(base.BaseVolumeAdminTest): @decorators.attr(type='negative') @decorators.idempotent_id('bf544854-d62a-47f2-a681-90f7a47d86b6') def test_quota_volumes(self): + """Creating more volume than allowed quota will fail""" self.admin_quotas_client.update_quota_set(self.demo_tenant_id, volumes=1, gigabytes=-1) self.assertRaises(lib_exc.OverLimit, @@ -61,6 +63,7 @@ class VolumeQuotasNegativeTestJSON(base.BaseVolumeAdminTest): @decorators.attr(type='negative') @decorators.idempotent_id('2dc27eee-8659-4298-b900-169d71a91374') def test_quota_volume_gigabytes(self): + """Creating volume with size larger than allowed quota will fail""" self.admin_quotas_client.update_quota_set( self.demo_tenant_id, gigabytes=CONF.volume.volume_size, volumes=-1) self.assertRaises(lib_exc.OverLimit, @@ -70,6 +73,7 @@ class VolumeQuotasNegativeTestJSON(base.BaseVolumeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('d321dc21-d8c6-401f-95fe-49f4845f1a6d') def test_volume_extend_gigabytes_quota_deviation(self): + """Extending volume with size larger than allowed quota will fail""" self.admin_quotas_client.update_quota_set( self.demo_tenant_id, gigabytes=CONF.volume.volume_size) self.assertRaises(lib_exc.OverLimit, diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py index ae290498e4..174cf9e495 100644 --- a/tempest/api/volume/admin/test_volume_types_negative.py +++ b/tempest/api/volume/admin/test_volume_types_negative.py @@ -20,11 +20,12 @@ from tempest.lib import exceptions as lib_exc class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): + """Negative tests of volume type""" @decorators.attr(type=['negative']) @decorators.idempotent_id('878b4e57-faa2-4659-b0d1-ce740a06ae81') def test_create_with_empty_name(self): - # Should not be able to create volume type with an empty name. + """Test creating volume type with an empty name will fail""" self.assertRaises( lib_exc.BadRequest, self.admin_volume_types_client.create_volume_type, name='') @@ -32,7 +33,7 @@ class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('994610d6-0476-4018-a644-a2602ef5d4aa') def test_get_nonexistent_type_id(self): - # Should not be able to get volume type with nonexistent type id. + """Test getting volume type with nonexistent type id will fail""" self.assertRaises(lib_exc.NotFound, self.admin_volume_types_client.show_volume_type, data_utils.rand_uuid()) @@ -40,7 +41,7 @@ class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('6b3926d2-7d73-4896-bc3d-e42dfd11a9f6') def test_delete_nonexistent_type_id(self): - # Should not be able to delete volume type with nonexistent type id. + """Test deleting volume type with nonexistent type id will fail""" self.assertRaises(lib_exc.NotFound, self.admin_volume_types_client.delete_volume_type, data_utils.rand_uuid()) @@ -48,7 +49,7 @@ class VolumeTypesNegativeTest(base.BaseVolumeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('8c09f849-f225-4d78-ba87-bffd9a5e0c6f') def test_create_volume_with_private_volume_type(self): - # Should not be able to create volume with private volume type. + """Test creating volume with private volume type will fail""" params = {'os-volume-type-access:is_public': False} volume_type = self.create_volume_type(**params) self.assertRaises(lib_exc.NotFound, diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py index 5bac3d877e..33e503fb71 100644 --- a/tempest/api/volume/admin/test_volumes_actions.py +++ b/tempest/api/volume/admin/test_volumes_actions.py @@ -23,6 +23,8 @@ CONF = config.CONF class VolumesActionsTest(base.BaseVolumeAdminTest): + """Test volume actions""" + create_default_network = True def _create_reset_and_force_delete_temp_volume(self, status=None): @@ -38,7 +40,10 @@ class VolumesActionsTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('d063f96e-a2e0-4f34-8b8a-395c42de1845') def test_volume_reset_status(self): - # test volume reset status : available->error->available->maintenance + """Test resetting volume status + + Reset volume status to available->error->available->maintenance + """ volume = self.create_volume() self.addCleanup(waiters.wait_for_volume_resource_status, self.volumes_client, volume['id'], 'available') @@ -52,27 +57,28 @@ class VolumesActionsTest(base.BaseVolumeAdminTest): @decorators.idempotent_id('21737d5a-92f2-46d7-b009-a0cc0ee7a570') def test_volume_force_delete_when_volume_is_creating(self): - # test force delete when status of volume is creating + """Test force deleting volume when its status is creating""" self._create_reset_and_force_delete_temp_volume('creating') @decorators.idempotent_id('db8d607a-aa2e-4beb-b51d-d4005c232011') def test_volume_force_delete_when_volume_is_attaching(self): - # test force delete when status of volume is attaching + """Test force deleting volume when its status is attaching""" self._create_reset_and_force_delete_temp_volume('attaching') @decorators.idempotent_id('3e33a8a8-afd4-4d64-a86b-c27a185c5a4a') def test_volume_force_delete_when_volume_is_error(self): - # test force delete when status of volume is error + """Test force deleting volume when its status is error""" self._create_reset_and_force_delete_temp_volume('error') @decorators.idempotent_id('b957cabd-1486-4e21-90cf-a9ed3c39dfb2') def test_volume_force_delete_when_volume_is_maintenance(self): - # test force delete when status of volume is maintenance + """Test force deleting volume when its status is maintenance""" self._create_reset_and_force_delete_temp_volume('maintenance') @decorators.idempotent_id('d38285d9-929d-478f-96a5-00e66a115b81') @utils.services('compute') def test_force_detach_volume(self): + """Test force detaching volume when its status is error""" # Create a server and a volume server_id = self.create_server()['id'] volume_id = self.create_volume()['id']