diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py index 2d7e1a7df2..786c7f03ab 100644 --- a/tempest/api/compute/admin/test_floating_ips_bulk.py +++ b/tempest/api/compute/admin/test_floating_ips_bulk.py @@ -63,7 +63,7 @@ class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest): @decorators.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab') @utils.services('network') def test_create_list_delete_floating_ips_bulk(self): - # Create, List and delete the Floating IPs Bulk + """Creating, listing and deleting the Floating IPs Bulk""" pool = 'test_pool' # NOTE(GMann): Reserving the IP range but those are not attached # anywhere. Using the below mentioned interface which is not ever diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py index 31fe2b531a..30f3388635 100644 --- a/tempest/api/compute/admin/test_hosts.py +++ b/tempest/api/compute/admin/test_hosts.py @@ -18,7 +18,7 @@ from tempest.lib import decorators class HostsAdminTestJSON(base.BaseV2ComputeAdminTest): - """Tests hosts API using admin privileges.""" + """Tests nova hosts API using admin privileges.""" max_microversion = '2.42' @@ -29,13 +29,13 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest): @decorators.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f') def test_list_hosts(self): - # Listing hosts. + """Listing nova hosts""" hosts = self.client.list_hosts()['hosts'] self.assertGreaterEqual(len(hosts), 2, str(hosts)) @decorators.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de') def test_list_hosts_with_zone(self): - # Listing hosts with specified availability zone + """Listing nova hosts with specified availability zone""" self.useFixture(fixtures.LockFixture('availability_zone')) hosts = self.client.list_hosts()['hosts'] host = hosts[0] @@ -45,23 +45,27 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest): @decorators.idempotent_id('9af3c171-fbf4-4150-a624-22109733c2a6') def test_list_hosts_with_a_blank_zone(self): - # Listing hosts with blank availability zone. - # If send the request with a blank zone, the request will be successful - # and it will return all the hosts list + """Listing nova hosts with blank availability zone + + If send the request with a blank zone, the request will be successful + and it will return all the hosts list + """ hosts = self.client.list_hosts(zone='')['hosts'] self.assertNotEmpty(hosts) @decorators.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8') def test_list_hosts_with_nonexistent_zone(self): - # Listing hosts with not existing availability zone. - # If send the request with a nonexistent zone, the request will be - # successful and no hosts will be returned + """Listing nova hosts with not existing availability zone. + + If send the request with a nonexistent zone, the request will be + successful and no hosts will be returned + """ hosts = self.client.list_hosts(zone='xxx')['hosts'] self.assertEmpty(hosts) @decorators.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4') def test_show_host_detail(self): - # Showing host details. + """Showing nova host details""" hosts = self.client.list_hosts()['hosts'] hosts = [host for host in hosts if host['service'] == 'compute'] diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py index e8733c8633..e9436bc330 100644 --- a/tempest/api/compute/admin/test_hosts_negative.py +++ b/tempest/api/compute/admin/test_hosts_negative.py @@ -39,21 +39,21 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('dd032027-0210-4d9c-860e-69b1b8deed5f') def test_list_hosts_with_non_admin_user(self): - # Non admin user is not allowed to list hosts. + """Non admin user is not allowed to list hosts""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.list_hosts) @decorators.attr(type=['negative']) @decorators.idempotent_id('e75b0a1a-041f-47a1-8b4a-b72a6ff36d3f') def test_show_host_detail_with_nonexistent_hostname(self): - # Showing host detail with not existing hostname should fail. + """Showing host detail with not existing hostname should fail""" self.assertRaises(lib_exc.NotFound, self.client.show_host, 'nonexistent_hostname') @decorators.attr(type=['negative']) @decorators.idempotent_id('19ebe09c-bfd4-4b7c-81a2-e2e0710f59cc') def test_show_host_detail_with_non_admin_user(self): - # Non admin user is not allowed to show host details. + """Non admin user is not allowed to show host details""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.show_host, self.hostname) @@ -61,7 +61,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('e40c72b1-0239-4ed6-ba21-81a184df1f7c') def test_update_host_with_non_admin_user(self): - # Non admin user is not allowed to update host. + """Non admin user is not allowed to update host""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.update_host, self.hostname, @@ -71,8 +71,10 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('fbe2bf3e-3246-4a95-a59f-94e4e298ec77') def test_update_host_with_invalid_status(self): - # Updating host to invalid status should fail, - # 'status' can only be 'enable' or 'disable'. + """Updating host to invalid status should fail + + 'status' can only be 'enable' or 'disable'. + """ self.assertRaises(lib_exc.BadRequest, self.client.update_host, self.hostname, @@ -82,8 +84,10 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('ab1e230e-5e22-41a9-8699-82b9947915d4') def test_update_host_with_invalid_maintenance_mode(self): - # Updating host to invalid maintenance mode should fail, - # 'maintenance_mode' can only be 'enable' or 'disable'. + """Updating host to invalid maintenance mode should fail + + 'maintenance_mode' can only be 'enable' or 'disable'. + """ self.assertRaises(lib_exc.BadRequest, self.client.update_host, self.hostname, @@ -93,8 +97,10 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('0cd85f75-6992-4a4a-b1bd-d11e37fd0eee') def test_update_host_without_param(self): - # Updating host without param should fail, - # 'status' or 'maintenance_mode' is needed for host update. + """Updating host without param should fail + + 'status' or 'maintenance_mode' is needed for host update + """ self.assertRaises(lib_exc.BadRequest, self.client.update_host, self.hostname) @@ -102,7 +108,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('23c92146-2100-4d68-b2d6-c7ade970c9c1') def test_update_nonexistent_host(self): - # Updating not existing host should fail. + """Updating not existing host should fail""" self.assertRaises(lib_exc.NotFound, self.client.update_host, 'nonexistent_hostname', @@ -112,7 +118,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('0d981ac3-4320-4898-b674-82b61fbb60e4') def test_startup_nonexistent_host(self): - # Starting up not existing host should fail. + """Starting up not existing host should fail""" self.assertRaises(lib_exc.NotFound, self.client.startup_host, 'nonexistent_hostname') @@ -120,7 +126,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('9f4ebb7e-b2ae-4e5b-a38f-0fd1bb0ddfca') def test_startup_host_with_non_admin_user(self): - # Non admin user is not allowed to startup host. + """Non admin user is not allowed to startup host""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.startup_host, self.hostname) @@ -128,7 +134,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('9e637444-29cf-4244-88c8-831ae82c31b6') def test_shutdown_nonexistent_host(self): - # Shutting down not existing host should fail. + """Shutting down not existing host should fail""" self.assertRaises(lib_exc.NotFound, self.client.shutdown_host, 'nonexistent_hostname') @@ -136,7 +142,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('a803529c-7e3f-4d3c-a7d6-8e1c203d27f6') def test_shutdown_host_with_non_admin_user(self): - # Non admin user is not allowed to shutdown host. + """Non admin user is not allowed to shutdown host""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.shutdown_host, self.hostname) @@ -144,7 +150,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('f86bfd7b-0b13-4849-ae29-0322e83ee58b') def test_reboot_nonexistent_host(self): - # Rebooting not existing host should fail. + """Rebooting not existing host should fail""" self.assertRaises(lib_exc.NotFound, self.client.reboot_host, 'nonexistent_hostname') @@ -152,7 +158,7 @@ class HostsAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): @decorators.attr(type=['negative']) @decorators.idempotent_id('02d79bb9-eb57-4612-abf6-2cb38897d2f8') def test_reboot_host_with_non_admin_user(self): - # Non admin user is not allowed to reboot host. + """Non admin user is not allowed to reboot host""" self.assertRaises(lib_exc.Forbidden, self.non_admin_client.reboot_host, self.hostname) diff --git a/tempest/api/compute/admin/test_hypervisor.py b/tempest/api/compute/admin/test_hypervisor.py index e45aac5ed5..347193de6d 100644 --- a/tempest/api/compute/admin/test_hypervisor.py +++ b/tempest/api/compute/admin/test_hypervisor.py @@ -36,19 +36,19 @@ class HypervisorAdminTestJSON(HypervisorAdminTestBase): @decorators.idempotent_id('7f0ceacd-c64d-4e96-b8ee-d02943142cc5') def test_get_hypervisor_list(self): - # List of hypervisor and available hypervisors hostname + """List of hypervisor and available hypervisors hostname""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers, "No hypervisors found.") @decorators.idempotent_id('1e7fdac2-b672-4ad1-97a4-bad0e3030118') def test_get_hypervisor_list_details(self): - # Display the details of the all hypervisor + """Display the details of the all hypervisor""" hypers = self.client.list_hypervisors(detail=True)['hypervisors'] self.assertNotEmpty(hypers, "No hypervisors found.") @decorators.idempotent_id('94ff9eae-a183-428e-9cdb-79fde71211cc') def test_get_hypervisor_show_details(self): - # Display the details of the specified hypervisor + """Display the details of the specified hypervisor""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers, "No hypervisors found.") @@ -59,14 +59,14 @@ class HypervisorAdminTestJSON(HypervisorAdminTestBase): @decorators.idempotent_id('797e4f28-b6e0-454d-a548-80cc77c00816') def test_get_hypervisor_stats(self): - # Verify the stats of the all hypervisor + """Verify the stats of the all hypervisor""" stats = (self.client.show_hypervisor_statistics() ['hypervisor_statistics']) self.assertNotEmpty(stats) @decorators.idempotent_id('91a50d7d-1c2b-4f24-b55a-a1fe20efca70') def test_get_hypervisor_uptime(self): - # Verify that GET shows the specified hypervisor uptime + """Verify that GET shows the specified hypervisor uptime""" hypers = self._list_hypervisors() # Ironic will register each baremetal node as a 'hypervisor', @@ -106,10 +106,13 @@ class HypervisorAdminTestJSON(HypervisorAdminTestBase): class HypervisorAdminV228Test(HypervisorAdminTestBase): + """Tests Hypervisors API higher than 2.27 that require admin privileges""" + min_microversion = '2.28' @decorators.idempotent_id('d46bab64-0fbe-4eb8-9133-e6ee56188cc5') def test_get_list_hypervisor_details(self): + """Test listing and showing hypervisor details""" # NOTE(zhufl): This test tests the hypervisor APIs response schema # for 2.28 microversion. No specific assert or behaviour verification # is needed. @@ -119,11 +122,13 @@ class HypervisorAdminV228Test(HypervisorAdminTestBase): class HypervisorAdminUnderV252Test(HypervisorAdminTestBase): + """Tests Hypervisors API below 2.53 that require admin privileges""" + max_microversion = '2.52' @decorators.idempotent_id('e81bba3f-6215-4e39-a286-d52d2f906862') def test_get_hypervisor_show_servers(self): - # Show instances about the specific hypervisors + """Test showing instances about the specific hypervisors""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers, "No hypervisors found.") @@ -134,7 +139,7 @@ class HypervisorAdminUnderV252Test(HypervisorAdminTestBase): @decorators.idempotent_id('d7e1805b-3b14-4a3b-b6fd-50ec6d9f361f') def test_search_hypervisor(self): - # Searching for hypervisors by its name. + """Test searching for hypervisors by its name""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers, "No hypervisors found.") hypers = self.client.search_hypervisor( diff --git a/tempest/api/compute/admin/test_hypervisor_negative.py b/tempest/api/compute/admin/test_hypervisor_negative.py index 723b93c79d..9aaffd9db9 100644 --- a/tempest/api/compute/admin/test_hypervisor_negative.py +++ b/tempest/api/compute/admin/test_hypervisor_negative.py @@ -40,8 +40,9 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('c136086a-0f67-4b2b-bc61-8482bd68989f') def test_show_nonexistent_hypervisor(self): - # Showing not existing hypervisor should fail. + """Test showing non existent hypervisor should fail""" nonexistent_hypervisor_id = data_utils.rand_uuid() + self.assertRaises( lib_exc.NotFound, self.client.show_hypervisor, @@ -50,7 +51,7 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('51e663d0-6b89-4817-a465-20aca0667d03') def test_show_hypervisor_with_non_admin_user(self): - # Non admin user is not allowed to show hypervisor. + """Test showing hypervisor by non admin user should fail""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers) @@ -62,7 +63,7 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('e2b061bb-13f9-40d8-9d6e-d5bf17595849') def test_get_hypervisor_stats_with_non_admin_user(self): - # Non admin user is not allowed to get hypervisor stats. + """Test getting hypervisor stats by non admin user should fail""" self.assertRaises( lib_exc.Forbidden, self.non_adm_client.show_hypervisor_statistics) @@ -70,7 +71,7 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('f60aa680-9a3a-4c7d-90e1-fae3a4891303') def test_get_nonexistent_hypervisor_uptime(self): - # Getting uptime of not existing hypervisor should fail. + """Test showing uptime of non existent hypervisor should fail""" nonexistent_hypervisor_id = data_utils.rand_uuid() self.assertRaises( @@ -81,7 +82,7 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('6c3461f9-c04c-4e2a-bebb-71dc9cb47df2') def test_get_hypervisor_uptime_with_non_admin_user(self): - # Non admin user is not allowed to get hypervisor uptime. + """Test showing uptime of hypervisor by non admin user should fail""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers) @@ -93,7 +94,7 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('51b3d536-9b14-409c-9bce-c6f7c794994e') def test_get_hypervisor_list_with_non_admin_user(self): - # List of hypervisor and available services with non admin user + """Test listing hypervisors by non admin user should fail""" self.assertRaises( lib_exc.Forbidden, self.non_adm_client.list_hypervisors) @@ -101,19 +102,21 @@ class HypervisorAdminNegativeTestJSON(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('dc02db05-e801-4c5f-bc8e-d915290ab345') def test_get_hypervisor_list_details_with_non_admin_user(self): - # Non admin user is not allowed to list hypervisor details. + """Test listing hypervisor details by non admin user should fail""" self.assertRaises( lib_exc.Forbidden, self.non_adm_client.list_hypervisors, detail=True) class HypervisorAdminNegativeUnderV252Test(HypervisorAdminNegativeTestBase): + """Tests Hypervisors API below ver 2.53 that require admin privileges""" + max_microversion = '2.52' @decorators.attr(type=['negative']) @decorators.idempotent_id('2a0a3938-832e-4859-95bf-1c57c236b924') def test_show_servers_with_non_admin_user(self): - # Non admin user is not allowed to show servers on hypervisor. + """Test showing hypervisor servers by non admin user should fail""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers) @@ -125,7 +128,7 @@ class HypervisorAdminNegativeUnderV252Test(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('02463d69-0ace-4d33-a4a8-93d7883a2bba') def test_show_servers_with_nonexistent_hypervisor(self): - # Showing servers on not existing hypervisor should fail. + """Test showing servers on non existent hypervisor should fail""" nonexistent_hypervisor_id = data_utils.rand_uuid() self.assertRaises( @@ -136,7 +139,7 @@ class HypervisorAdminNegativeUnderV252Test(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('5b6a6c79-5dc1-4fa5-9c58-9c8085948e74') def test_search_hypervisor_with_non_admin_user(self): - # Non admin user is not allowed to search hypervisor. + """Test searching hypervisor by non admin user should fail""" hypers = self._list_hypervisors() self.assertNotEmpty(hypers) @@ -148,7 +151,7 @@ class HypervisorAdminNegativeUnderV252Test(HypervisorAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('19a45cc1-1000-4055-b6d2-28e8b2ec4faa') def test_search_nonexistent_hypervisor(self): - # Searching not existing hypervisor should fail. + """Test searching non existent hypervisor should fail""" self.assertRaises( lib_exc.NotFound, self.client.search_hypervisor, diff --git a/tempest/api/compute/admin/test_keypairs_v210.py b/tempest/api/compute/admin/test_keypairs_v210.py index 40ed5327cc..30681275f1 100644 --- a/tempest/api/compute/admin/test_keypairs_v210.py +++ b/tempest/api/compute/admin/test_keypairs_v210.py @@ -19,6 +19,8 @@ from tempest.lib import decorators class KeyPairsV210TestJSON(base.BaseKeypairTest): + """Tests KeyPairs API with microversion higher than 2.9""" + credentials = ['primary', 'admin'] min_microversion = '2.10' @@ -48,6 +50,13 @@ class KeyPairsV210TestJSON(base.BaseKeypairTest): @decorators.idempotent_id('3c8484af-cfb3-48f6-b8ba-d5d58bbf3eac') def test_admin_manage_keypairs_for_other_users(self): + """Test admin managing keypairs for other users + + First admin creates a keypair for an other user, then admin lists + keypairs filtered by that user, and keypairs created for that user + should appear in the result and keypairs not created for that user + should not appear in the result. + """ user_id = self.non_admin_client.user_id key_list = self._create_and_check_keypairs(user_id) first_keyname = key_list[0]['name'] diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py index f90ff924a5..04dbc2d56c 100644 --- a/tempest/api/compute/admin/test_quotas_negative.py +++ b/tempest/api/compute/admin/test_quotas_negative.py @@ -53,10 +53,12 @@ class QuotasAdminNegativeTestBase(base.BaseV2ComputeAdminTest): class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase): + """Negative tests of nova quotas""" @decorators.attr(type=['negative']) @decorators.idempotent_id('733abfe8-166e-47bb-8363-23dbd7ff3476') def test_update_quota_normal_user(self): + """Test updating nova quota by normal user should fail""" self.assertRaises(lib_exc.Forbidden, self.client.update_quota_set, self.demo_tenant_id, @@ -67,7 +69,7 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('91058876-9947-4807-9f22-f6eb17140d9b') def test_create_server_when_cpu_quota_is_full(self): - # Disallow server creation when tenant's vcpu quota is full + """Disallow server creation when tenant's vcpu quota is full""" self._update_quota('cores', 0) self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit), self.create_test_server) @@ -75,7 +77,7 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('6fdd7012-584d-4327-a61c-49122e0d5864') def test_create_server_when_memory_quota_is_full(self): - # Disallow server creation when tenant's memory quota is full + """Disallow server creation when tenant's memory quota is full""" self._update_quota('ram', 0) self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit), self.create_test_server) @@ -83,13 +85,15 @@ class QuotasAdminNegativeTest(QuotasAdminNegativeTestBase): @decorators.attr(type=['negative']) @decorators.idempotent_id('7c6be468-0274-449a-81c3-ac1c32ee0161') def test_create_server_when_instances_quota_is_full(self): - # Once instances quota limit is reached, disallow server creation + """Once instances quota limit is reached, disallow server creation""" self._update_quota('instances', 0) self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit), self.create_test_server) class QuotasSecurityGroupAdminNegativeTest(QuotasAdminNegativeTestBase): + """Negative tests of nova security group quota""" + max_microversion = '2.35' @decorators.skip_because(bug="1186354", @@ -98,7 +102,7 @@ class QuotasSecurityGroupAdminNegativeTest(QuotasAdminNegativeTestBase): @decorators.idempotent_id('7c6c8f3b-2bf6-4918-b240-57b136a66aa0') @utils.services('network') def test_security_groups_exceed_limit(self): - # Negative test: Creation Security Groups over limit should FAIL + """Negative test: Creation Security Groups over limit should FAIL""" # Set the quota to number of used security groups sg_quota = self.limits_client.show_limits()['limits']['absolute'][ 'totalSecurityGroupsUsed'] @@ -117,7 +121,7 @@ class QuotasSecurityGroupAdminNegativeTest(QuotasAdminNegativeTestBase): @decorators.idempotent_id('6e9f436d-f1ed-4f8e-a493-7275dfaa4b4d') @utils.services('network') def test_security_groups_rules_exceed_limit(self): - # Negative test: Creation of Security Group Rules should FAIL + """Negative test: Creation of Security Group Rules should FAIL""" # when we reach limit maxSecurityGroupRules self._update_quota('security_group_rules', 0) diff --git a/tempest/api/compute/admin/test_services.py b/tempest/api/compute/admin/test_services.py index bf846e58c7..24518a828e 100644 --- a/tempest/api/compute/admin/test_services.py +++ b/tempest/api/compute/admin/test_services.py @@ -19,7 +19,10 @@ from tempest.lib import decorators class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest): - """Tests Services API. List and Enable/Disable require admin privileges.""" + """Tests Nova Services API. + + List and Enable/Disable require admin privileges. + """ @classmethod def setup_clients(cls): @@ -28,13 +31,13 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest): @decorators.idempotent_id('5be41ef4-53d1-41cc-8839-5c2a48a1b283') def test_list_services(self): - # Listing nova services + """Listing nova services""" services = self.client.list_services()['services'] self.assertNotEmpty(services) @decorators.idempotent_id('f345b1ec-bc6e-4c38-a527-3ca2bc00bef5') def test_get_service_by_service_binary_name(self): - # Listing nova services by binary name. + """Listing nova services by binary name""" binary_name = 'nova-compute' services = self.client.list_services(binary=binary_name)['services'] self.assertNotEmpty(services) @@ -43,7 +46,7 @@ class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest): @decorators.idempotent_id('affb42d5-5b4b-43c8-8b0b-6dca054abcca') def test_get_service_by_host_name(self): - # Listing nova services by host name. + """Listing nova services by host name""" services = self.client.list_services()['services'] host_name = services[0]['host'] services_on_host = [service for service in services if diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py index 20294e9a44..58861a16c6 100644 --- a/tempest/api/compute/flavors/test_flavors.py +++ b/tempest/api/compute/flavors/test_flavors.py @@ -18,11 +18,12 @@ from tempest.lib import decorators class FlavorsV2TestJSON(base.BaseV2ComputeTest): + """Tests Flavors""" @decorators.attr(type='smoke') @decorators.idempotent_id('e36c0eaa-dff5-4082-ad1f-3f9a80aa3f59') def test_list_flavors(self): - # List of all flavors should contain the expected flavor + """List of all flavors should contain the expected flavor""" flavors = self.flavors_client.list_flavors()['flavors'] flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'], @@ -31,7 +32,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('6e85fde4-b3cd-4137-ab72-ed5f418e8c24') def test_list_flavors_with_detail(self): - # Detailed list of all flavors should contain the expected flavor + """Detailed list of all flavors should contain the expected flavor""" flavors = self.flavors_client.list_flavors(detail=True)['flavors'] flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] self.assertIn(flavor, flavors) @@ -39,20 +40,20 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.attr(type='smoke') @decorators.idempotent_id('1f12046b-753d-40d2-abb6-d8eb8b30cb2f') def test_get_flavor(self): - # The expected flavor details should be returned + """The expected flavor details should be returned""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] self.assertEqual(self.flavor_ref, flavor['id']) @decorators.idempotent_id('8d7691b3-6ed4-411a-abc9-2839a765adab') def test_list_flavors_limit_results(self): - # Only the expected number of flavors should be returned + """Only the expected number of flavors should be returned""" params = {'limit': 1} flavors = self.flavors_client.list_flavors(**params)['flavors'] self.assertEqual(1, len(flavors)) @decorators.idempotent_id('b26f6327-2886-467a-82be-cef7a27709cb') def test_list_flavors_detailed_limit_results(self): - # Only the expected number of flavors (detailed) should be returned + """Only the expected number of flavors(detailed) should be returned""" params = {'limit': 1} flavors = self.flavors_client.list_flavors(detail=True, **params)['flavors'] @@ -60,7 +61,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('e800f879-9828-4bd0-8eae-4f17189951fb') def test_list_flavors_using_marker(self): - # The list of flavors should start from the provided marker + """The list of flavors should start from the provided marker""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id'] @@ -71,7 +72,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('6db2f0c0-ddee-4162-9c84-0703d3dd1107') def test_list_flavors_detailed_using_marker(self): - # The list of flavors should start from the provided marker + """The list of flavors should start from the provided marker""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id'] @@ -83,7 +84,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('3df2743e-3034-4e57-a4cb-b6527f6eac79') def test_list_flavors_detailed_filter_by_min_disk(self): - # The detailed list of flavors should be filtered by disk space + """The detailed list of flavors should be filtered by disk space""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id'] @@ -94,7 +95,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('09fe7509-b4ee-4b34-bf8b-39532dc47292') def test_list_flavors_detailed_filter_by_min_ram(self): - # The detailed list of flavors should be filtered by RAM + """The detailed list of flavors should be filtered by RAM""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id'] @@ -105,7 +106,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('10645a4d-96f5-443f-831b-730711e11dd4') def test_list_flavors_filter_by_min_disk(self): - # The list of flavors should be filtered by disk space + """The list of flavors should be filtered by disk space""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id'] @@ -115,7 +116,7 @@ class FlavorsV2TestJSON(base.BaseV2ComputeTest): @decorators.idempotent_id('935cf550-e7c8-4da6-8002-00f92d5edfaa') def test_list_flavors_filter_by_min_ram(self): - # The list of flavors should be filtered by RAM + """The list of flavors should be filtered by RAM""" flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor'] flavor_id = flavor['id']