From 0539a64d1b13adc10d9912676dcb21648add9f4e Mon Sep 17 00:00:00 2001 From: zhufl Date: Tue, 18 Aug 2020 16:10:03 +0800 Subject: [PATCH] Adding description for testcases - swift 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: Id8f747c0eb018847bd9dc5bc3801ee973704da4b partially-implements: blueprint testcase-description --- .../api/object_storage/test_account_bulk.py | 7 +-- .../api/object_storage/test_account_quotas.py | 2 + .../test_account_services_negative.py | 3 +- .../api/object_storage/test_container_acl.py | 5 +- .../object_storage/test_container_services.py | 51 +++++++++++-------- .../api/object_storage/test_healthcheck.py | 2 + .../api/object_storage/test_object_version.py | 11 ++++ 7 files changed, 53 insertions(+), 28 deletions(-) diff --git a/tempest/api/object_storage/test_account_bulk.py b/tempest/api/object_storage/test_account_bulk.py index 80f790f51f..687fe5750a 100644 --- a/tempest/api/object_storage/test_account_bulk.py +++ b/tempest/api/object_storage/test_account_bulk.py @@ -21,6 +21,7 @@ from tempest.lib import decorators class BulkTest(base.BaseObjectTest): + """Test bulk operation of archived file""" def setUp(self): super(BulkTest, self).setUp() @@ -70,7 +71,7 @@ class BulkTest(base.BaseObjectTest): @decorators.idempotent_id('a407de51-1983-47cc-9f14-47c2b059413c') @utils.requires_ext(extension='bulk_upload', service='object') def test_extract_archive(self): - # Test bulk operation of file upload with an archived file + """Test bulk operation of file upload with an archived file""" filepath, container_name, object_name = self._create_archive() resp = self._upload_archive(filepath) self.containers.append(container_name) @@ -95,7 +96,7 @@ class BulkTest(base.BaseObjectTest): @decorators.idempotent_id('c075e682-0d2a-43b2-808d-4116200d736d') @utils.requires_ext(extension='bulk_delete', service='object') def test_bulk_delete(self): - # Test bulk operation of deleting multiple files + """Test bulk operation of deleting multiple files""" filepath, container_name, object_name = self._create_archive() self._upload_archive(filepath) @@ -110,7 +111,7 @@ class BulkTest(base.BaseObjectTest): @decorators.idempotent_id('dbea2bcb-efbb-4674-ac8a-a5a0e33d1d79') @utils.requires_ext(extension='bulk_delete', service='object') def test_bulk_delete_by_POST(self): - # Test bulk operation of deleting multiple files + """Test bulk operation of deleting multiple files by HTTP POST""" filepath, container_name, object_name = self._create_archive() self._upload_archive(filepath) diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py index 48f42ec57d..6854bbeb9e 100644 --- a/tempest/api/object_storage/test_account_quotas.py +++ b/tempest/api/object_storage/test_account_quotas.py @@ -22,6 +22,7 @@ CONF = config.CONF class AccountQuotasTest(base.BaseObjectTest): + """Test account quotas""" credentials = [['operator', CONF.object_storage.operator_role], ['reseller', CONF.object_storage.reseller_admin_role]] @@ -79,6 +80,7 @@ class AccountQuotasTest(base.BaseObjectTest): @decorators.idempotent_id('a22ef352-a342-4587-8f47-3bbdb5b039c4') @utils.requires_ext(extension='account_quotas', service='object') def test_upload_valid_object(self): + """Test uploading valid object""" object_name = data_utils.rand_name(name="TestObject") data = data_utils.arbitrary_string() resp, _ = self.object_client.create_object(self.container_name, diff --git a/tempest/api/object_storage/test_account_services_negative.py b/tempest/api/object_storage/test_account_services_negative.py index 3e664d74a3..8d2a501f41 100644 --- a/tempest/api/object_storage/test_account_services_negative.py +++ b/tempest/api/object_storage/test_account_services_negative.py @@ -21,6 +21,7 @@ CONF = config.CONF class AccountNegativeTest(base.BaseObjectTest): + """Negative tests of account""" credentials = [['operator', CONF.object_storage.operator_role], ['operator_alt', CONF.object_storage.operator_role]] @@ -33,7 +34,7 @@ class AccountNegativeTest(base.BaseObjectTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('070e6aca-6152-4867-868d-1118d68fb38c') def test_list_containers_with_non_authorized_user(self): - # list containers using non-authorized user + """Test listing containers using non-authorized user""" test_auth_provider = self.os_operator.auth_provider # Get auth for the test user diff --git a/tempest/api/object_storage/test_container_acl.py b/tempest/api/object_storage/test_container_acl.py index e9ca0b1784..c8731fec01 100644 --- a/tempest/api/object_storage/test_container_acl.py +++ b/tempest/api/object_storage/test_container_acl.py @@ -22,6 +22,7 @@ CONF = config.CONF class ObjectTestACLs(base.BaseObjectTest): + """Test object ACLs""" credentials = [['operator', CONF.object_storage.operator_role], ['operator_alt', CONF.object_storage.operator_role]] @@ -36,7 +37,7 @@ class ObjectTestACLs(base.BaseObjectTest): @decorators.idempotent_id('a3270f3f-7640-4944-8448-c7ea783ea5b6') def test_read_object_with_rights(self): - # attempt to read object using authorized user + """Test reading object using authorized user""" # update X-Container-Read metadata ACL tenant_id = self.os_roles_operator_alt.credentials.tenant_id user_id = self.os_roles_operator_alt.credentials.user_id @@ -64,7 +65,7 @@ class ObjectTestACLs(base.BaseObjectTest): @decorators.idempotent_id('aa58bfa5-40d9-4bc3-82b4-d07f4a9e392a') def test_write_object_with_rights(self): - # attempt to write object using authorized user + """Test writing object using authorized user""" # update X-Container-Write metadata ACL tenant_id = self.os_roles_operator_alt.credentials.tenant_id user_id = self.os_roles_operator_alt.credentials.user_id diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py index cdc420e507..7ad6f6fe7b 100644 --- a/tempest/api/object_storage/test_container_services.py +++ b/tempest/api/object_storage/test_container_services.py @@ -19,6 +19,8 @@ from tempest.lib import decorators class ContainerTest(base.BaseObjectTest): + """Test containers""" + def tearDown(self): self.delete_containers() super(ContainerTest, self).tearDown() @@ -26,6 +28,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.attr(type='smoke') @decorators.idempotent_id('92139d73-7819-4db1-85f8-3f2f22a8d91f') def test_create_container(self): + """Test creating container""" container_name = data_utils.rand_name(name='TestContainer') resp, _ = self.container_client.update_container(container_name) self.containers.append(container_name) @@ -33,7 +36,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('49f866ed-d6af-4395-93e7-4187eb56d322') def test_create_container_overwrite(self): - # overwrite container with the same name + """Test overwriting container with the same name""" container_name = data_utils.rand_name(name='TestContainer') self.container_client.update_container(container_name) self.containers.append(container_name) @@ -43,7 +46,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('c2ac4d59-d0f5-40d5-ba19-0635056d48cd') def test_create_container_with_metadata_key(self): - # create container with the blank value of metadata + """Test creating container with the blank value of metadata""" container_name = data_utils.rand_name(name='TestContainer') headers = {'X-Container-Meta-test-container-meta': ''} resp, _ = self.container_client.update_container( @@ -60,7 +63,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('e1e8df32-7b22-44e1-aa08-ccfd8d446b58') def test_create_container_with_metadata_value(self): - # create container with metadata value + """Test creating container with metadata value""" container_name = data_utils.rand_name(name='TestContainer') # metadata name using underscores should be converted to hyphens @@ -79,7 +82,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('24d16451-1c0c-4e4f-b59c-9840a3aba40e') def test_create_container_with_remove_metadata_key(self): - # create container with the blank value of remove metadata + """Test creating container with the blank value of remove metadata""" container_name = data_utils.rand_name(name='TestContainer') headers = {'X-Container-Meta-test-container-meta': 'Meta1'} self.container_client.update_container(container_name, **headers) @@ -97,7 +100,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('8a21ebad-a5c7-4e29-b428-384edc8cd156') def test_create_container_with_remove_metadata_value(self): - # create container with remove metadata + """Test creating container with remove metadata""" container_name = data_utils.rand_name(name='TestContainer') headers = {'X-Container-Meta-test-container-meta': 'Meta1'} self.container_client.update_container(container_name, **headers) @@ -114,6 +117,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('95d3a249-b702-4082-a2c4-14bb860cf06a') def test_delete_container(self): + """Test deleting container""" # create a container container_name = self.create_container() # delete container, success asserted within @@ -123,7 +127,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.attr(type='smoke') @decorators.idempotent_id('312ff6bd-5290-497f-bda1-7c5fec6697ab') def test_list_container_contents(self): - # get container contents list + """Test getting container contents list""" container_name = self.create_container() object_name, _ = self.create_object(container_name) @@ -134,7 +138,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('4646ac2d-9bfb-4c7d-a3c5-0f527402b3df') def test_list_container_contents_with_no_object(self): - # get empty container contents list + """Test getting empty container contents list""" container_name = self.create_container() resp, object_list = self.container_client.list_container_objects( @@ -144,7 +148,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('fe323a32-57b9-4704-a996-2e68f83b09bc') def test_list_container_contents_with_delimiter(self): - # get container contents list using delimiter param + """Test getting container contents list using delimiter param""" container_name = self.create_container() object_name = data_utils.rand_name(name='TestObject/') self.create_object(container_name, object_name) @@ -158,7 +162,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('55b4fa5c-e12e-4ca9-8fcf-a79afe118522') def test_list_container_contents_with_end_marker(self): - # get container contents list using end_marker param + """Test getting container contents list using end_marker param""" container_name = self.create_container() object_name, _ = self.create_object(container_name) @@ -171,7 +175,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('196f5034-6ab0-4032-9da9-a937bbb9fba9') def test_list_container_contents_with_format_json(self): - # get container contents list using format_json param + """Test getting container contents list using format_json param""" container_name = self.create_container() self.create_object(container_name) @@ -190,7 +194,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('655a53ca-4d15-408c-a377-f4c6dbd0a1fa') def test_list_container_contents_with_format_xml(self): - # get container contents list using format_xml param + """Test getting container contents list using format_xml param""" container_name = self.create_container() self.create_object(container_name) @@ -214,7 +218,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('297ec38b-2b61-4ff4-bcd1-7fa055e97b61') def test_list_container_contents_with_limit(self): - # get container contents list using limit param + """Test getting container contents list using limit param""" container_name = self.create_container() object_name, _ = self.create_object(container_name) @@ -227,7 +231,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('c31ddc63-2a58-4f6b-b25c-94d2937e6867') def test_list_container_contents_with_marker(self): - # get container contents list using marker param + """Test getting container contents list using marker param""" container_name = self.create_container() object_name, _ = self.create_object(container_name) @@ -240,7 +244,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('58ca6cc9-6af0-408d-aaec-2a6a7b2f0df9') def test_list_container_contents_with_path(self): - # get container contents list using path param + """Test getting container contents list using path param""" container_name = self.create_container() object_name = data_utils.rand_name(name='TestObject') object_name = 'Swift/' + object_name @@ -255,7 +259,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('77e742c7-caf2-4ec9-8aa4-f7d509a3344c') def test_list_container_contents_with_prefix(self): - # get container contents list using prefix param + """Test getting container contents list using prefix param""" container_name = self.create_container() object_name, _ = self.create_object(container_name) @@ -270,7 +274,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.attr(type='smoke') @decorators.idempotent_id('96e68f0e-19ec-4aa2-86f3-adc6a45e14dd') def test_list_container_metadata(self): - # List container metadata + """Test listing container metadata""" container_name = self.create_container() metadata = {'name': 'Pictures'} @@ -286,7 +290,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('a2faf936-6b13-4f8d-92a2-c2278355821e') def test_list_no_container_metadata(self): - # HEAD container without metadata + """Test listing container without metadata""" container_name = self.create_container() resp, _ = self.container_client.list_container_metadata( @@ -296,7 +300,10 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('cf19bc0b-7e16-4a5a-aaed-cb0c2fe8deef') def test_update_container_metadata_with_create_and_delete_metadata(self): - # Send one request of adding and deleting metadata + """Test updating container with adding and deleting metadata + + Send one request of adding and deleting metadata. + """ container_name = data_utils.rand_name(name='TestContainer') metadata_1 = {'X-Container-Meta-test-container-meta1': 'Meta1'} self.container_client.update_container(container_name, **metadata_1) @@ -319,7 +326,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('2ae5f295-4bf1-4e04-bfad-21e54b62cec5') def test_update_container_metadata_with_create_metadata(self): - # update container metadata using add metadata + """Test updating container metadata using add metadata""" container_name = self.create_container() metadata = {'test-container-meta1': 'Meta1'} @@ -337,7 +344,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('3a5ce7d4-6e4b-47d0-9d87-7cd42c325094') def test_update_container_metadata_with_delete_metadata(self): - # update container metadata using delete metadata + """Test updating container metadata using delete metadata""" container_name = data_utils.rand_name(name='TestContainer') metadata = {'X-Container-Meta-test-container-meta1': 'Meta1'} self.container_client.update_container(container_name, **metadata) @@ -355,7 +362,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('31f40a5f-6a52-4314-8794-cd89baed3040') def test_update_container_metadata_with_create_metadata_key(self): - # update container metadata with a blank value of metadata + """Test updating container metadata with a blank value of metadata""" container_name = self.create_container() metadata = {'test-container-meta1': ''} @@ -371,7 +378,7 @@ class ContainerTest(base.BaseObjectTest): @decorators.idempotent_id('a2e36378-6f1f-43f4-840a-ffd9cfd61914') def test_update_container_metadata_with_delete_metadata_key(self): - # update container metadata with a blank value of metadata + """Test updating container metadata with a blank value of metadata""" container_name = data_utils.rand_name(name='TestContainer') headers = {'X-Container-Meta-test-container-meta1': 'Meta1'} self.container_client.update_container(container_name, **headers) diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py index 8e9e4061d2..f5e2443b55 100644 --- a/tempest/api/object_storage/test_healthcheck.py +++ b/tempest/api/object_storage/test_healthcheck.py @@ -19,12 +19,14 @@ from tempest.lib import decorators class HealthcheckTest(base.BaseObjectTest): + """Test healthcheck""" def setUp(self): super(HealthcheckTest, self).setUp() @decorators.idempotent_id('db5723b1-f25c-49a9-bfeb-7b5640caf337') def test_get_healthcheck(self): + """Test getting healthcheck""" url = self.account_client._get_base_version_url() + "healthcheck" resp, body = self.account_client.raw_request(url, "GET") self.account_client._error_checker(resp, body) diff --git a/tempest/api/object_storage/test_object_version.py b/tempest/api/object_storage/test_object_version.py index 75111b6e9d..b64b1729dd 100644 --- a/tempest/api/object_storage/test_object_version.py +++ b/tempest/api/object_storage/test_object_version.py @@ -24,6 +24,8 @@ CONF = config.CONF class ContainerTest(base.BaseObjectTest): + """Test versioned container""" + def assertContainer(self, container, count, byte, versioned): resp, _ = self.container_client.list_container_metadata(container) self.assertHeaders(resp, 'Container', 'HEAD') @@ -39,6 +41,15 @@ class ContainerTest(base.BaseObjectTest): not CONF.object_storage_feature_enabled.object_versioning, 'Object-versioning is disabled') def test_versioned_container(self): + """Test versioned container + + 1. create container1 + 2. create container2, with container1 as 'X-versions-Location' header + 3. create object1 in container1 + 4. create 2nd version of object1 + 5. delete object version 2 + 6. delete object version 1 + """ # create container vers_container_name = data_utils.rand_name(name='TestVersionContainer') resp, _ = self.container_client.update_container(vers_container_name)