Merge "Skip test_qos_min_bw_allocation_basic when not supported"
diff --git a/releasenotes/notes/add-can-migrate-between-any-hosts-config-option-x8ah4f9737a28e9b.yaml b/releasenotes/notes/add-can-migrate-between-any-hosts-config-option-x8ah4f9737a28e9b.yaml
new file mode 100644
index 0000000..26fe01a
--- /dev/null
+++ b/releasenotes/notes/add-can-migrate-between-any-hosts-config-option-x8ah4f9737a28e9b.yaml
@@ -0,0 +1,9 @@
+---
+features:
+ - Add a new config option can_migrate_between_any_hosts in the
+ compute-feature-enabled section, which can be set to False for environment
+ with non homogeneous compute nodes, so that it can select a destination
+ host for migrating automatically, otherwise the testcase may fail
+ unexpectedly. e.g., if source host is with CPU "E5-2699 v4" and the
+ selected target host is with CPU "E5-2670 v3", the live-migration will
+ fail because of the downgrade issue.
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index 0901374..0414b91 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -18,7 +18,7 @@
class AgentsAdminTestJSON(base.BaseV2ComputeAdminTest):
- """Tests Agents API"""
+ """Tests Compute Agents API"""
@classmethod
def setup_clients(cls):
@@ -46,7 +46,7 @@
@decorators.idempotent_id('1fc6bdc8-0b6d-4cc7-9f30-9b04fabe5b90')
def test_create_agent(self):
- # Create an agent.
+ """Test creating a compute agent"""
params = self._param_helper(
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
@@ -58,6 +58,7 @@
@decorators.idempotent_id('dc9ffd51-1c50-4f0e-a820-ae6d2a568a9e')
def test_update_agent(self):
+ """Test updating a compute agent"""
# Create and update an agent.
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
@@ -71,7 +72,7 @@
@decorators.idempotent_id('470e0b89-386f-407b-91fd-819737d0b335')
def test_delete_agent(self):
- # Create an agent and delete it.
+ """Test deleting a compute agent"""
body = self.client.create_agent(**self.params_agent)['agent']
self.client.delete_agent(body['agent_id'])
@@ -82,7 +83,7 @@
@decorators.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
- # Create an agent and list all agents.
+ """Test listing compute agents"""
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
agents = self.client.list_agents()['agents']
@@ -91,7 +92,7 @@
@decorators.idempotent_id('eabadde4-3cd7-4ec4-a4b5-5a936d2d4408')
def test_list_agents_with_filter(self):
- # Create agents and list the agent builds by the filter.
+ """Test listing compute agents by the filter"""
body = self.client.create_agent(**self.params_agent)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
params = self._param_helper(
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 7a3bfdf..2716259 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -71,10 +71,11 @@
class AggregatesAdminTestJSON(AggregatesAdminTestBase):
+ """Tests Aggregates API that require admin privileges"""
@decorators.idempotent_id('0d148aa3-d54c-4317-aa8d-42040a475e20')
def test_aggregate_create_delete(self):
- # Create and delete an aggregate.
+ """Test create/delete aggregate"""
aggregate = self._create_test_aggregate()
self.assertIsNone(aggregate['availability_zone'])
@@ -83,7 +84,7 @@
@decorators.idempotent_id('5873a6f8-671a-43ff-8838-7ce430bb6d0b')
def test_aggregate_create_delete_with_az(self):
- # Create and delete an aggregate.
+ """Test create/delete aggregate with availability_zone"""
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self._create_test_aggregate(availability_zone=az_name)
self.assertEqual(az_name, aggregate['availability_zone'])
@@ -93,7 +94,7 @@
@decorators.idempotent_id('68089c38-04b1-4758-bdf0-cf0daec4defd')
def test_aggregate_create_verify_entry_in_list(self):
- # Create an aggregate and ensure it is listed.
+ """Test listing aggregate should contain the created aggregate"""
aggregate = self._create_test_aggregate()
aggregates = self.client.list_aggregates()['aggregates']
self.assertIn((aggregate['id'], aggregate['availability_zone']),
@@ -102,7 +103,7 @@
@decorators.idempotent_id('36ec92ca-7a73-43bc-b920-7531809e8540')
def test_aggregate_create_update_metadata_get_details(self):
- # Create an aggregate and ensure its details are returned.
+ """Test set/get aggregate metadata"""
aggregate = self._create_test_aggregate()
body = self.client.show_aggregate(aggregate['id'])['aggregate']
self.assertEqual(aggregate['name'], body['name'])
@@ -121,7 +122,7 @@
@decorators.idempotent_id('4d2b2004-40fa-40a1-aab2-66f4dab81beb')
def test_aggregate_create_update_with_az(self):
- # Update an aggregate and ensure properties are updated correctly
+ """Test create/update aggregate with availability_zone"""
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self._create_test_aggregate(
@@ -148,7 +149,7 @@
@decorators.idempotent_id('c8e85064-e79b-4906-9931-c11c24294d02')
def test_aggregate_add_remove_host(self):
- # Add a host to the given aggregate and remove.
+ """Test adding host to and removing host from aggregate"""
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = self._create_test_aggregate(name=aggregate_name)
@@ -169,7 +170,10 @@
@decorators.idempotent_id('7f6a1cc5-2446-4cdb-9baa-b6ae0a919b72')
def test_aggregate_add_host_list(self):
- # Add a host to the given aggregate and list.
+ """Test listing aggregate contains the host added to the aggregate
+
+ Add a host to the given aggregate and list.
+ """
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = self._create_test_aggregate(name=aggregate_name)
@@ -188,7 +192,10 @@
@decorators.idempotent_id('eeef473c-7c52-494d-9f09-2ed7fc8fc036')
def test_aggregate_add_host_get_details(self):
- # Add a host to the given aggregate and get details.
+ """Test showing aggregate contains the host added to the aggregate
+
+ Add a host to the given aggregate and get details.
+ """
self.useFixture(fixtures.LockFixture('availability_zone'))
aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
aggregate = self._create_test_aggregate(name=aggregate_name)
@@ -204,7 +211,7 @@
@decorators.idempotent_id('96be03c7-570d-409c-90f8-e4db3c646996')
def test_aggregate_add_host_create_server_with_az(self):
- # Add a host to the given aggregate and create a server.
+ """Test adding a host to the given aggregate and creating a server"""
self.useFixture(fixtures.LockFixture('availability_zone'))
az_name = data_utils.rand_name(self.az_name_prefix)
aggregate = self._create_test_aggregate(availability_zone=az_name)
@@ -233,6 +240,11 @@
class AggregatesAdminTestV241(AggregatesAdminTestBase):
+ """Tests Aggregates API that require admin privileges
+
+ Tests Aggregates API that require admin privileges with compute
+ microversion greater than 2.40.
+ """
min_microversion = '2.41'
# NOTE(gmann): This test tests the Aggregate APIs response schema
@@ -241,6 +253,11 @@
@decorators.idempotent_id('fdf24d9e-8afa-4700-b6aa-9c498351504f')
def test_create_update_show_aggregate_add_remove_host(self):
+ """Test response schema of aggregates API
+
+ Test response schema of aggregates API(create/update/show/add host/
+ remove host) with compute microversion greater than 2.40.
+ """
# Update and add a host to the given aggregate and get details.
self.useFixture(fixtures.LockFixture('availability_zone'))
# Checking create aggregate API response schema
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index bbd39b6..3eb0d9a 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -27,12 +27,12 @@
@decorators.idempotent_id('d3431479-8a09-4f76-aa2d-26dc580cb27c')
def test_get_availability_zone_list(self):
- # List of availability zone
+ """Test listing availability zones"""
availability_zone = self.client.list_availability_zones()
self.assertNotEmpty(availability_zone['availabilityZoneInfo'])
@decorators.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
- # List of availability zones and available services
+ """Test listing availability zones with detail"""
availability_zone = self.client.list_availability_zones(detail=True)
self.assertNotEmpty(availability_zone['availabilityZoneInfo'])
diff --git a/tempest/api/compute/admin/test_availability_zone_negative.py b/tempest/api/compute/admin/test_availability_zone_negative.py
index a58c22c..6e576e8 100644
--- a/tempest/api/compute/admin/test_availability_zone_negative.py
+++ b/tempest/api/compute/admin/test_availability_zone_negative.py
@@ -18,7 +18,7 @@
class AZAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
- """Tests Availability Zone API List"""
+ """Negative Tests of Availability Zone API List"""
@classmethod
def setup_clients(cls):
@@ -28,8 +28,12 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('bf34dca2-fdc3-4073-9c02-7648d9eae0d7')
def test_get_availability_zone_list_detail_with_non_admin_user(self):
- # List of availability zones and available services with
- # non-administrator user
+ """Test listing availability zone with detail by non-admin user
+
+ List of availability zones and available services with
+ non-administrator user is not allowed.
+ """
+
self.assertRaises(
lib_exc.Forbidden,
self.non_adm_client.list_availability_zones, detail=True)
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 66c2c2d..9de3da9 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -22,6 +22,7 @@
class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
+ """Test fixed ips API"""
@classmethod
def skip_checks(cls):
@@ -56,13 +57,16 @@
@decorators.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52')
def test_list_fixed_ip_details(self):
+ """Test getting fixed ip details"""
fixed_ip = self.client.show_fixed_ip(self.ip)
self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip)
@decorators.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
def test_set_reserve(self):
+ """Test reserving fixed ip"""
self.client.reserve_fixed_ip(self.ip, reserve="None")
@decorators.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e')
def test_set_unreserve(self):
+ """Test unreserving fixed ip"""
self.client.reserve_fixed_ip(self.ip, unreserve="None")
diff --git a/tempest/api/compute/admin/test_fixed_ips_negative.py b/tempest/api/compute/admin/test_fixed_ips_negative.py
index 7d41f46..1629faa 100644
--- a/tempest/api/compute/admin/test_fixed_ips_negative.py
+++ b/tempest/api/compute/admin/test_fixed_ips_negative.py
@@ -22,6 +22,7 @@
class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
+ """Negative tests of fixed ips API"""
@classmethod
def skip_checks(cls):
@@ -58,12 +59,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9f17f47d-daad-4adc-986e-12370c93e407')
def test_list_fixed_ip_details_with_non_admin_user(self):
+ """Test listing fixed ip with detail by non-admin user is forbidden"""
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.show_fixed_ip, self.ip)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ce60042c-fa60-4836-8d43-1c8e3359dc47')
def test_set_reserve_with_non_admin_user(self):
+ """Test reserving fixed ip by non-admin user is forbidden"""
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.reserve_fixed_ip,
self.ip, reserve="None")
@@ -71,6 +74,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f1f7a35b-0390-48c5-9803-5f27461439db')
def test_set_unreserve_with_non_admin_user(self):
+ """Test unreserving fixed ip by non-admin user is forbidden"""
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.reserve_fixed_ip,
self.ip, unreserve="None")
@@ -78,6 +82,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f51cf464-7fc5-4352-bc3e-e75cfa2cb717')
def test_set_reserve_with_invalid_ip(self):
+ """Test reserving invalid fixed ip should fail"""
# NOTE(maurosr): since this exercises the same code snippet, we do it
# only for reserve action
# NOTE(eliqiao): in Juno, the exception is NotFound, but in master, we
@@ -90,6 +95,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('fd26ef50-f135-4232-9d32-281aab3f9176')
def test_fixed_ip_with_invalid_action(self):
+ """Test operating fixed ip with invalid action should fail"""
self.assertRaises(lib_exc.BadRequest,
self.client.reserve_fixed_ip,
self.ip, invalid_action="None")
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index b8e2b42..87ab7c7 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -43,8 +43,12 @@
@decorators.idempotent_id('ea2c2211-29fa-4db9-97c3-906d36fad3e0')
def test_flavor_access_list_with_private_flavor(self):
- # Test to make sure that list flavor access on a newly created
- # private flavor will return an empty access list
+ """Test listing flavor access for a private flavor
+
+ Listing flavor access on a newly created private flavor will return
+ an empty access list.
+ """
+ # Test to make sure that
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
@@ -54,7 +58,7 @@
@decorators.idempotent_id('59e622f6-bdf6-45e3-8ba8-fedad905a6b4')
def test_flavor_access_add_remove(self):
- # Test to add and remove flavor access to a given tenant.
+ """Test add/remove flavor access to a given project"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index 45ca10a..ac09cb0 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -46,7 +46,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0621c53e-d45d-40e7-951d-43e5e257b272')
def test_flavor_access_list_with_public_flavor(self):
- # Test to list flavor access with exceptions by querying public flavor
+ """Test listing flavor access of a public flavor should fail"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='True')
self.assertRaises(lib_exc.NotFound,
@@ -56,7 +56,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('41eaaade-6d37-4f28-9c74-f21b46ca67bd')
def test_flavor_non_admin_add(self):
- # Test to add flavor access as a user without admin privileges.
+ """Test adding flavor access by a non-admin user is forbidden"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
self.assertRaises(lib_exc.Forbidden,
@@ -67,7 +67,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('073e79a6-c311-4525-82dc-6083d919cb3a')
def test_flavor_non_admin_remove(self):
- # Test to remove flavor access as a user without admin privileges.
+ """Test removing flavor access by a non-admin user should fail"""
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
@@ -84,6 +84,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f3592cc0-0306-483c-b210-9a7b5346eddc')
def test_add_flavor_access_duplicate(self):
+ """Test adding duplicate flavor access to same flavor should fail"""
# Create a new flavor.
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
@@ -104,6 +105,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1f710927-3bc7-4381-9f82-0ca6e42644b7')
def test_remove_flavor_access_not_found(self):
+ """Test removing non existent flavor access should fail"""
# Create a new flavor.
flavor = self.create_flavor(ram=self.ram, vcpus=self.vcpus,
disk=self.disk, is_public='False')
diff --git a/tempest/api/compute/admin/test_flavors_microversions.py b/tempest/api/compute/admin/test_flavors_microversions.py
index 31b9217..d904cbd 100644
--- a/tempest/api/compute/admin/test_flavors_microversions.py
+++ b/tempest/api/compute/admin/test_flavors_microversions.py
@@ -18,6 +18,8 @@
class FlavorsV255TestJSON(base.BaseV2ComputeAdminTest):
+ """Test flavors API with compute microversion greater than 2.54"""
+
min_microversion = '2.55'
max_microversion = 'latest'
@@ -26,6 +28,11 @@
@decorators.idempotent_id('61976b25-488d-41dc-9dcb-cb9693a7b075')
def test_crud_flavor(self):
+ """Test create/show/update/list flavor
+
+ Check the response schema of flavors API with microversion greater
+ than 2.54.
+ """
flavor_id = data_utils.rand_int_id(start=1000)
# Checking create API response schema
new_flavor_id = self.create_flavor(ram=512,
@@ -44,6 +51,7 @@
class FlavorsV261TestJSON(FlavorsV255TestJSON):
+ """Test flavors API with compute microversion greater than 2.60"""
min_microversion = '2.61'
max_microversion = 'latest'
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 064949f..941315e 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -71,6 +71,10 @@
def _live_migrate(self, server_id, target_host, state,
volume_backed=False):
+ # If target_host is None, check whether source host is different with
+ # the new host after migration.
+ if target_host is None:
+ source_host = self.get_host_for_server(server_id)
self._migrate_server_to(server_id, target_host, volume_backed)
waiters.wait_for_server_status(self.servers_client, server_id, state)
migration_list = (self.admin_migration_client.list_migrations()
@@ -82,8 +86,12 @@
if (live_migration['instance_uuid'] == server_id):
msg += "\n%s" % live_migration
msg += "]"
- self.assertEqual(target_host, self.get_host_for_server(server_id),
- msg)
+ if target_host is None:
+ self.assertNotEqual(source_host,
+ self.get_host_for_server(server_id), msg)
+ else:
+ self.assertEqual(target_host, self.get_host_for_server(server_id),
+ msg)
class LiveMigrationTest(LiveMigrationTestBase):
@@ -105,7 +113,11 @@
server_id = self.create_test_server(wait_until="ACTIVE",
volume_backed=volume_backed)['id']
source_host = self.get_host_for_server(server_id)
- destination_host = self.get_host_other_than(server_id)
+ if not CONF.compute_feature_enabled.can_migrate_between_any_hosts:
+ # not to specify a host so that the scheduler will pick one
+ destination_host = None
+ else:
+ destination_host = self.get_host_other_than(server_id)
if state == 'PAUSED':
self.admin_servers_client.pause_server(server_id)
@@ -161,7 +173,11 @@
"""Test live migrating a server with volume attached"""
server = self.create_test_server(wait_until="ACTIVE")
server_id = server['id']
- target_host = self.get_host_other_than(server_id)
+ if not CONF.compute_feature_enabled.can_migrate_between_any_hosts:
+ # not to specify a host so that the scheduler will pick one
+ target_host = None
+ else:
+ target_host = self.get_host_other_than(server_id)
volume = self.create_volume()
diff --git a/tempest/api/compute/admin/test_live_migration_negative.py b/tempest/api/compute/admin/test_live_migration_negative.py
index 8327a3b..80c0525 100644
--- a/tempest/api/compute/admin/test_live_migration_negative.py
+++ b/tempest/api/compute/admin/test_live_migration_negative.py
@@ -24,6 +24,8 @@
class LiveMigrationNegativeTest(base.BaseV2ComputeAdminTest):
+ """Negative tests of live migration"""
+
@classmethod
def skip_checks(cls):
super(LiveMigrationNegativeTest, cls).skip_checks()
@@ -40,7 +42,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7fb7856e-ae92-44c9-861a-af62d7830bcb')
def test_invalid_host_for_migration(self):
- # Migrating to an invalid host should not change the status
+ """Test migrating to an invalid host should not change the status"""
target_host = data_utils.rand_name('host')
server = self.create_test_server(wait_until="ACTIVE")
@@ -52,6 +54,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6e2f94f5-2ee8-4830-bef5-5bc95bb0795b')
def test_live_block_migration_suspended(self):
+ """Test migrating a suspended server should not change the status"""
server = self.create_test_server(wait_until="ACTIVE")
self.admin_servers_client.suspend_server(server['id'])
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 0060ffe..9d5e0c9 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -97,9 +97,11 @@
class QuotasAdminTestJSON(QuotasAdminTestBase):
+ """Test compute quotas by admin user"""
+
@decorators.idempotent_id('3b0a7c8f-cf58-46b8-a60c-715a32a8ba7d')
def test_get_default_quotas(self):
- # Admin can get the default resource quota set for a tenant
+ """Test admin can get the default compute quota set for a project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
@@ -109,7 +111,7 @@
@decorators.idempotent_id('55fbe2bf-21a9-435b-bbd2-4162b0ed799a')
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 compute quota limits for a project"""
default_quota_set = self.adm_client.show_default_quota_set(
self.demo_tenant_id)['quota_set']
new_quota_set = {'metadata_items': 256, 'ram': 10240,
@@ -140,11 +142,12 @@
# TODO(afazekas): merge these test cases
@decorators.idempotent_id('ce9e0815-8091-4abd-8345-7fe5b85faa1d')
def test_get_updated_quotas(self):
+ """Test that GET shows the updated quota set of project"""
self._get_updated_quotas()
@decorators.idempotent_id('389d04f0-3a41-405f-9317-e5f86e3c44f0')
def test_delete_quota(self):
- # Admin can delete the resource quota set for a project
+ """Test admin can delete the compute quota set for a project"""
project_name = data_utils.rand_name('ram_quota_project')
project_desc = project_name + '-desc'
project = identity.identity_utils(self.os_admin).create_project(
@@ -165,26 +168,40 @@
class QuotasAdminTestV236(QuotasAdminTestBase):
- min_microversion = '2.36'
+ """Test compute quotas with microversion greater than 2.35
+
# NOTE(gmann): This test tests the Quota APIs response schema
# for 2.36 microversion. No specific assert or behaviour verification
# is needed.
+ """
+
+ min_microversion = '2.36'
@decorators.idempotent_id('4268b5c9-92e5-4adc-acf1-3a2798f3d803')
def test_get_updated_quotas(self):
- # Checking Quota update, get, get details APIs response schema
+ """Test compute quotas API with microversion greater than 2.35
+
+ Checking compute quota update, get, get details APIs response schema.
+ """
self._get_updated_quotas()
class QuotasAdminTestV257(QuotasAdminTestBase):
- min_microversion = '2.57'
+ """Test compute quotas with microversion greater than 2.56
+
# NOTE(gmann): This test tests the Quota APIs response schema
# for 2.57 microversion. No specific assert or behaviour verification
# is needed.
+ """
+
+ min_microversion = '2.57'
@decorators.idempotent_id('e641e6c6-e86c-41a4-9e5c-9493c0ae47ad')
def test_get_updated_quotas(self):
- # Checking Quota update, get, get details APIs response schema
+ """Test compute quotas API with microversion greater than 2.56
+
+ Checking compute quota update, get, get details APIs response schema.
+ """
self._get_updated_quotas()
@@ -212,6 +229,7 @@
# 'danger' flag.
@decorators.idempotent_id('7932ab0f-5136-4075-b201-c0e2338df51a')
def test_update_default_quotas(self):
+ """Test updating default compute quota class set"""
# get the current 'default' quota class values
body = (self.adm_client.show_quota_class_set('default')
['quota_class_set'])
diff --git a/tempest/api/compute/admin/test_server_diagnostics_negative.py b/tempest/api/compute/admin/test_server_diagnostics_negative.py
index 6215c37..8f14cbc 100644
--- a/tempest/api/compute/admin/test_server_diagnostics_negative.py
+++ b/tempest/api/compute/admin/test_server_diagnostics_negative.py
@@ -18,6 +18,7 @@
class ServerDiagnosticsNegativeTest(base.BaseV2ComputeAdminTest):
+ """Negative tests of server diagnostics"""
@classmethod
def setup_clients(cls):
@@ -27,7 +28,10 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
def test_get_server_diagnostics_by_non_admin(self):
- # Non-admin user cannot view server diagnostics according to policy
+ """Test getting server diagnostics by non-admin user is forbidden
+
+ Non-admin user cannot view server diagnostics according to policy.
+ """
server_id = self.create_test_server(wait_until='ACTIVE')['id']
self.assertRaises(lib_exc.Forbidden,
self.client.show_server_diagnostics, server_id)
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 170b2cc..530c8fb 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -45,7 +45,7 @@
@decorators.idempotent_id('06f960bb-15bb-48dc-873d-f96e89be7870')
def test_list_servers_filter_by_error_status(self):
- # Filter the list of servers by server error status
+ """Test filtering the list of servers by server error status"""
params = {'status': 'error'}
self.client.reset_state(self.s1_id, state='error')
body = self.non_admin_client.list_servers(**params)
@@ -61,6 +61,7 @@
@decorators.idempotent_id('d56e9540-73ed-45e0-9b88-98fc419087eb')
def test_list_servers_detailed_filter_by_invalid_status(self):
+ """Test filtering the list of servers by invalid server status"""
params = {'status': 'invalid_status'}
if self.is_requested_microversion_compatible('2.37'):
body = self.client.list_servers(detail=True, **params)
@@ -72,8 +73,11 @@
@decorators.idempotent_id('51717b38-bdc1-458b-b636-1cf82d99f62f')
def test_list_servers_by_admin(self):
- # Listing servers by admin user returns a list which doesn't
- # contain the other tenants' server by default
+ """Test listing servers by admin without other projects
+
+ Listing servers by admin user returns a list which doesn't
+ contain the other projects' server by default.
+ """
body = self.client.list_servers(detail=True)
servers = body['servers']
@@ -85,8 +89,11 @@
@decorators.idempotent_id('9f5579ae-19b4-4985-a091-2a5d56106580')
def test_list_servers_by_admin_with_all_tenants(self):
- # Listing servers by admin user with all tenants parameter
- # Here should be listed all servers
+ """Test listing servers by admin with all tenants
+
+ Listing servers by admin user with all tenants parameter,
+ all servers should be listed.
+ """
params = {'all_tenants': ''}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@@ -98,8 +105,10 @@
@decorators.related_bug('1659811')
@decorators.idempotent_id('7e5d6b8f-454a-4ba1-8ae2-da857af8338b')
def test_list_servers_by_admin_with_specified_tenant(self):
- # In nova v2, tenant_id is ignored unless all_tenants is specified
+ """Test listing servers by admin with specified project
+ In nova v2, tenant_id is ignored unless all_tenants is specified.
+ """
# List the primary tenant but get nothing due to odd specified behavior
tenant_id = self.non_admin_client.tenant_id
params = {'tenant_id': tenant_id}
@@ -128,7 +137,7 @@
@decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f')
def test_list_servers_filter_by_exist_host(self):
- # Filter the list of servers by existent host
+ """Test filtering the list of servers by existent host"""
server = self.client.show_server(self.s1_id)['server']
hostname = server['OS-EXT-SRV-ATTR:host']
params = {'host': hostname, 'all_tenants': '1'}
@@ -144,6 +153,7 @@
@decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
def test_reset_state_server(self):
+ """Test resetting server state to error/active"""
# Reset server's state to 'error'
self.client.reset_state(self.s1_id, state='error')
@@ -160,9 +170,11 @@
@decorators.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442')
def test_rebuild_server_in_error_state(self):
- # The server in error state should be rebuilt using the provided
- # image and changed to ACTIVE state
+ """Test rebuilding server in error state
+ The server in error state should be rebuilt using the provided
+ image and changed to ACTIVE state.
+ """
# resetting vm state require admin privilege
self.client.reset_state(self.s1_id, state='error')
rebuilt_server = self.non_admin_client.rebuild_server(
@@ -188,6 +200,7 @@
@decorators.idempotent_id('7a1323b4-a6a2-497a-96cb-76c07b945c71')
def test_reset_network_inject_network_info(self):
+ """Test resetting and injecting network info of a server"""
# Reset Network of a Server
server = self.create_test_server(wait_until='ACTIVE')
self.client.reset_network(server['id'])
@@ -196,6 +209,7 @@
@decorators.idempotent_id('fdcd9b33-0903-4e00-a1f7-b5f6543068d6')
def test_create_server_with_scheduling_hint(self):
+ """Test creating server with scheduling hint"""
# Create a server with scheduler hints.
hints = {
'same_host': self.s1_id
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index f720b84..f52d4c0 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -26,7 +26,7 @@
class ServersAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
- """Tests Servers API using admin privileges"""
+ """Negative Tests of Servers API using admin privileges"""
@classmethod
def setup_clients(cls):
@@ -47,6 +47,7 @@
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_using_overlimit_ram(self):
+ """Test resizing server using over limit ram should fail"""
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
self.useFixture(fixtures.LockFixture('compute_quotas'))
quota_set = self.quotas_client.show_quota_set(
@@ -69,6 +70,7 @@
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_using_overlimit_vcpus(self):
+ """Test resizing server using over limit vcpus should fail"""
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
self.useFixture(fixtures.LockFixture('compute_quotas'))
quota_set = self.quotas_client.show_quota_set(
@@ -89,6 +91,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b0b4d8af-1256-41ef-9ee7-25f1c19dde80')
def test_reset_state_server_invalid_state(self):
+ """Test resetting server state to invalid state value should fail"""
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state='invalid')
@@ -96,6 +99,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4cdcc984-fab0-4577-9a9d-6d558527ee9d')
def test_reset_state_server_invalid_type(self):
+ """Test resetting server state to invalid state type should fail"""
self.assertRaises(lib_exc.BadRequest,
self.client.reset_state, self.s1_id,
state=1)
@@ -103,13 +107,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e741298b-8df2-46f0-81cb-8f814ff2504c')
def test_reset_state_server_nonexistent_server(self):
+ """Test resetting a non existent server's state should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.reset_state, '999', state='error')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('46a4e1ca-87ae-4d28-987a-1b6b136a0221')
def test_migrate_non_existent_server(self):
- # migrate a non existent server
+ """Test migrating a non existent server should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.migrate_server,
data_utils.rand_uuid())
@@ -121,6 +126,7 @@
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_migrate_server_invalid_state(self):
+ """Test migrating a server with invalid state should fail"""
# create server.
server = self.create_test_server(wait_until='ACTIVE')
server_id = server['id']
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage.py b/tempest/api/compute/admin/test_simple_tenant_usage.py
index d4c60b3..c24f420 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage.py
@@ -26,6 +26,7 @@
class TenantUsagesTestJSON(base.BaseV2ComputeAdminTest):
+ """Test tenant usages"""
@classmethod
def setup_clients(cls):
@@ -67,7 +68,7 @@
@decorators.idempotent_id('062c8ae9-9912-4249-8b51-e38d664e926e')
def test_list_usage_all_tenants(self):
- # Get usage for all tenants
+ """Test getting usage for all tenants"""
tenant_usage = self.call_until_valid(
self.adm_client.list_tenant_usages, VALID_WAIT,
start=self.start, end=self.end, detailed="1")['tenant_usages'][0]
@@ -75,7 +76,7 @@
@decorators.idempotent_id('94135049-a4c5-4934-ad39-08fa7da4f22e')
def test_get_usage_tenant(self):
- # Get usage for a specific tenant
+ """Test getting usage for a specific tenant"""
tenant_usage = self.call_until_valid(
self.adm_client.show_tenant_usage, VALID_WAIT,
self.tenant_id, start=self.start, end=self.end)['tenant_usage']
@@ -84,7 +85,7 @@
@decorators.idempotent_id('9d00a412-b40e-4fd9-8eba-97b496316116')
def test_get_usage_tenant_with_non_admin_user(self):
- # Get usage for a specific tenant with non admin user
+ """Test getting usage for a specific tenant with non admin user"""
tenant_usage = self.call_until_valid(
self.client.show_tenant_usage, VALID_WAIT,
self.tenant_id, start=self.start, end=self.end)['tenant_usage']
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index cb60b8d..4b5a5d5 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -21,6 +21,7 @@
class TenantUsagesNegativeTestJSON(base.BaseV2ComputeAdminTest):
+ """Negative tests of compute tenant usages API"""
@classmethod
def setup_clients(cls):
@@ -43,7 +44,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8b21e135-d94b-4991-b6e9-87059609c8ed')
def test_get_usage_tenant_with_empty_tenant_id(self):
- # Get usage for a specific tenant empty
+ """Test getting tenant usage with empty tenant id should fail"""
params = {'start': self.start,
'end': self.end}
self.assertRaises(lib_exc.NotFound,
@@ -53,7 +54,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4079dd2a-9e8d-479f-869d-6fa985ce45b6')
def test_get_usage_tenant_with_invalid_date(self):
- # Get usage for tenant with invalid date
+ """Test getting tenant usage with invalid time range should fail"""
params = {'start': self.end,
'end': self.start}
self.assertRaises(lib_exc.BadRequest,
@@ -63,7 +64,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('bbe6fe2c-15d8-404c-a0a2-44fad0ad5cc7')
def test_list_usage_all_tenants_with_non_admin_user(self):
- # Get usage for all tenants with non admin user
+ """Test listing usage of all tenants by non-admin user is forbidden"""
params = {'start': self.start,
'end': self.end,
'detailed': "1"}
diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py
index 0e6c016..5917931 100644
--- a/tempest/api/compute/certificates/test_certificates.py
+++ b/tempest/api/compute/certificates/test_certificates.py
@@ -21,6 +21,7 @@
class CertificatesV2TestJSON(base.BaseV2ComputeTest):
+ """Test Certificates API"""
@classmethod
def skip_checks(cls):
@@ -30,10 +31,10 @@
@decorators.idempotent_id('c070a441-b08e-447e-a733-905909535b1b')
def test_create_root_certificate(self):
- # create certificates
+ """Test creating root certificate"""
self.certificates_client.create_certificate()
@decorators.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c')
def test_get_root_certificate(self):
- # get the root certificate
+ """Test getting root certificate details"""
self.certificates_client.show_certificate('root')
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 2adc482..6097bbc 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -25,13 +25,13 @@
class FloatingIPsTestJSON(base.BaseFloatingIPsTest):
+ """Test floating ips API with compute microversion less than 2.36"""
max_microversion = '2.35'
@decorators.idempotent_id('f7bfb946-297e-41b8-9e8c-aba8e9bb5194')
def test_allocate_floating_ip(self):
- # Positive test:Allocation of a new floating IP to a project
- # should be successful
+ """Test allocating a floating ip to a project"""
body = self.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
floating_ip_id_allocated = body['id']
@@ -45,8 +45,7 @@
@decorators.idempotent_id('de45e989-b5ca-4a9b-916b-04a52e7bbb8b')
def test_delete_floating_ip(self):
- # Positive test:Deletion of valid floating IP from project
- # should be successful
+ """Test deleting a valid floating ip from project"""
# Creating the floating IP that is to be deleted in this method
floating_ip_body = self.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
@@ -59,6 +58,7 @@
class FloatingIPsAssociationTestJSON(base.BaseFloatingIPsTest):
+ """Test floating ips association with microversion less than 2.44"""
max_microversion = '2.43'
@@ -80,9 +80,7 @@
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_associate_disassociate_floating_ip(self):
- # Positive test:Associate and disassociate the provided floating IP
- # to a specific server should be successful
-
+ """Test associate/disassociate floating ip to a server"""
# Association of floating IP to fixed IP address
self.client.associate_floating_ip_to_server(
self.floating_ip,
@@ -102,6 +100,12 @@
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_associate_already_associated_floating_ip(self):
+ """Test associating an already associated floating ip
+
+ First associate a floating ip to server1, then associate the floating
+ ip to server2, the floating ip will be associated to server2 and no
+ longer associated to server1.
+ """
# positive test:Association of an already associated floating IP
# to specific server should change the association of the Floating IP
# Create server so as to use for Multiple association
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
index 9257458..e99e218 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions_negative.py
@@ -25,6 +25,7 @@
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
+ """Test floating ips API with compute microversion less than 2.36"""
max_microversion = '2.35'
@@ -46,8 +47,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6e0f059b-e4dd-48fb-8207-06e3bba5b074')
def test_allocate_floating_ip_from_nonexistent_pool(self):
- # Negative test:Allocation of a new floating IP from a nonexistent_pool
- # to a project should fail
+ """Test allocating floating ip from non existent pool should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.create_floating_ip,
pool="non_exist_pool")
@@ -55,15 +55,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ae1c55a8-552b-44d4-bfb6-2a115a15d0ba')
def test_delete_nonexistent_floating_ip(self):
- # Negative test:Deletion of a nonexistent floating IP
- # from project should fail
-
+ """Test deleting non existent floating ip should fail"""
# Deleting the non existent floating IP
self.assertRaises(lib_exc.NotFound, self.client.delete_floating_ip,
self.non_exist_id)
class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
+ """Test floating ips API with compute microversion less than 2.44"""
max_microversion = '2.43'
@@ -76,8 +75,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('595fa616-1a71-4670-9614-46564ac49a4c')
def test_associate_nonexistent_floating_ip(self):
- # Negative test:Association of a non existent floating IP
- # to specific server should fail
+ """Test associating non existent floating ip to server should fail"""
# Associating non existent floating IP
self.assertRaises(lib_exc.NotFound,
self.client.associate_floating_ip_to_server,
@@ -86,7 +84,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0a081a66-e568-4e6b-aa62-9587a876dca8')
def test_dissociate_nonexistent_floating_ip(self):
- # Negative test:Dissociation of a non existent floating IP should fail
+ """Test dissociating non existent floating ip should fail"""
# Dissociating non existent floating IP
self.assertRaises(lib_exc.NotFound,
self.client.disassociate_floating_ip_from_server,
@@ -95,7 +93,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('804b4fcb-bbf5-412f-925d-896672b61eb3')
def test_associate_ip_to_server_without_passing_floating_ip(self):
- # Negative test:Association of empty floating IP to specific server
+ """Test associating empty floating ip to server should fail"""
# should raise NotFound or BadRequest(In case of Nova V2.1) exception.
self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.associate_floating_ip_to_server,
@@ -106,10 +104,13 @@
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_associate_ip_to_server_with_floating_ip(self):
- # The VM have one port
- # Associate floating IP A to the VM
- # Associate floating IP B which is from same pool with floating IP A
- # to the VM, should raise BadRequest exception
+ """Test associating floating ip to server already with floating ip
+
+ 1. The VM have one port
+ 2. Associate floating IP A to the VM
+ 3. Associate floating IP B which is from same pool with floating IP A
+ to the VM, should raise BadRequest exception
+ """
body = self.client.create_floating_ip(
pool=CONF.network.public_network_id)['floating_ip']
self.addCleanup(self.client.delete_floating_ip, body['id'])
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index 944f798..6bfee95 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -21,6 +21,7 @@
class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
+ """Test floating ip details with compute microversion less than 2.36"""
max_microversion = '2.35'
@@ -37,7 +38,7 @@
@decorators.idempotent_id('16db31c3-fb85-40c9-bbe2-8cf7b67ff99f')
def test_list_floating_ips(self):
- # Positive test:Should return the list of floating IPs
+ """Test listing floating ips"""
body = self.client.list_floating_ips()['floating_ips']
floating_ips = body
self.assertNotEmpty(floating_ips,
@@ -47,7 +48,7 @@
@decorators.idempotent_id('eef497e0-8ff7-43c8-85ef-558440574f84')
def test_get_floating_ip_details(self):
- # Positive test:Should be able to GET the details of floatingIP
+ """Test getting floating ip details"""
# Creating a floating IP for which details are to be checked
body = self.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
@@ -68,7 +69,7 @@
@decorators.idempotent_id('df389fc8-56f5-43cc-b290-20eda39854d3')
def test_list_floating_ip_pools(self):
- # Positive test:Should return the list of floating IP Pools
+ """Test listing floating ip pools"""
floating_ip_pools = self.pools_client.list_floating_ip_pools()
self.assertNotEmpty(floating_ip_pools['floating_ip_pools'],
"Expected floating IP Pools. Got zero.")
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
index d69248c..aa0320d 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips_negative.py
@@ -23,14 +23,18 @@
class FloatingIPDetailsNegativeTestJSON(base.BaseFloatingIPsTest):
+ """Negative tests of floating ip detail
+
+ Negative tests of floating ip detail with compute microversion less
+ than 2.36.
+ """
max_microversion = '2.35'
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7ab18834-4a4b-4f28-a2c5-440579866695')
def test_get_nonexistent_floating_ip_details(self):
- # Negative test:Should not be able to GET the details
- # of non-existent floating IP
+ """Test getting non existent floating ip should fail"""
# Creating a non-existent floatingIP id
if CONF.service_available.neutron:
non_exist_id = data_utils.rand_uuid()
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 1f3af5f..561265f 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -28,6 +28,8 @@
class ImagesMetadataTestJSON(base.BaseV2ComputeTest):
+ """Test image metadata with compute microversion less than 2.39"""
+
max_microversion = '2.38'
@classmethod
@@ -89,7 +91,10 @@
@decorators.idempotent_id('37ec6edd-cf30-4c53-bd45-ae74db6b0531')
def test_list_image_metadata(self):
- # All metadata key/value pairs for an image should be returned
+ """Test listing image metadata
+
+ All metadata key/value pairs for an image should be returned.
+ """
resp_metadata = self.client.list_image_metadata(self.image_id)
expected = {'metadata': {
'os_version': 'value1', 'os_distro': 'value2'}}
@@ -97,7 +102,10 @@
@decorators.idempotent_id('ece7befc-d3ce-42a4-b4be-c3067a418c29')
def test_set_image_metadata(self):
- # The metadata for the image should match the new values
+ """Test setting image metadata
+
+ The metadata for the image should match the new values.
+ """
req_metadata = {'os_version': 'value2', 'architecture': 'value3'}
self.client.set_image_metadata(self.image_id,
req_metadata)
@@ -108,7 +116,10 @@
@decorators.idempotent_id('7b491c11-a9d5-40fe-a696-7f7e03d3fea2')
def test_update_image_metadata(self):
- # The metadata for the image should match the updated values
+ """Test updating image medata
+
+ The metadata for the image should match the updated values.
+ """
req_metadata = {'os_version': 'alt1', 'architecture': 'value3'}
self.client.update_image_metadata(self.image_id,
req_metadata)
@@ -122,15 +133,21 @@
@decorators.idempotent_id('4f5db52f-6685-4c75-b848-f4bb363f9aa6')
def test_get_image_metadata_item(self):
- # The value for a specific metadata key should be returned
+ """Test getting image metadata item
+
+ The value for a specific metadata key should be returned.
+ """
meta = self.client.show_image_metadata_item(self.image_id,
'os_distro')['meta']
self.assertEqual('value2', meta['os_distro'])
@decorators.idempotent_id('f2de776a-4778-4d90-a5da-aae63aee64ae')
def test_set_image_metadata_item(self):
- # The value provided for the given meta item should be set for
- # the image
+ """Test setting image metadata item
+
+ The value provided for the given meta item should be set for
+ the image.
+ """
meta = {'os_version': 'alt'}
self.client.set_image_metadata_item(self.image_id,
'os_version', meta)
@@ -140,7 +157,10 @@
@decorators.idempotent_id('a013796c-ba37-4bb5-8602-d944511def14')
def test_delete_image_metadata_item(self):
- # The metadata value/key pair should be deleted from the image
+ """Test deleting image metadata item
+
+ The metadata value/key pair should be deleted from the image.
+ """
self.client.delete_image_metadata_item(self.image_id,
'os_version')
resp_metadata = self.client.list_image_metadata(self.image_id)
diff --git a/tempest/api/compute/images/test_image_metadata_negative.py b/tempest/api/compute/images/test_image_metadata_negative.py
index 407fb08..b9806c7 100644
--- a/tempest/api/compute/images/test_image_metadata_negative.py
+++ b/tempest/api/compute/images/test_image_metadata_negative.py
@@ -20,6 +20,11 @@
class ImagesMetadataNegativeTestJSON(base.BaseV2ComputeTest):
+ """Negative tests of image metadata
+
+ Negative tests of image metadata with compute microversion less than 2.39.
+ """
+
max_microversion = '2.38'
@classmethod
@@ -30,15 +35,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('94069db2-792f-4fa8-8bd3-2271a6e0c095')
def test_list_nonexistent_image_metadata(self):
- # Negative test: List on nonexistent image
- # metadata should not happen
+ """Test listing metadata of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound, self.client.list_image_metadata,
data_utils.rand_uuid())
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a403ef9e-9f95-427c-b70a-3ce3388796f1')
def test_update_nonexistent_image_metadata(self):
- # Negative test:An update should not happen for a non-existent image
+ """Test updating metadata of a non existence image should fail"""
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(lib_exc.NotFound,
self.client.update_image_metadata,
@@ -47,7 +51,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('41ae052c-6ee6-405c-985e-5712393a620d')
def test_get_nonexistent_image_metadata_item(self):
- # Negative test: Get on non-existent image should not happen
+ """Test getting metadata of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.show_image_metadata_item,
data_utils.rand_uuid(), 'os_version')
@@ -55,7 +59,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('dc64f2ce-77e8-45b0-88c8-e15041d08eaf')
def test_set_nonexistent_image_metadata(self):
- # Negative test: Metadata should not be set to a non-existent image
+ """Test setting metadata of a non existence image should fail"""
meta = {'os_distro': 'alt1', 'os_version': 'alt2'}
self.assertRaises(lib_exc.NotFound, self.client.set_image_metadata,
data_utils.rand_uuid(), meta)
@@ -63,8 +67,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('2154fd03-ab54-457c-8874-e6e3eb56e9cf')
def test_set_nonexistent_image_metadata_item(self):
- # Negative test: Metadata item should not be set to a
- # nonexistent image
+ """Test setting metadata item of a non existence image should fail"""
meta = {'os_distro': 'alt'}
self.assertRaises(lib_exc.NotFound,
self.client.set_image_metadata_item,
@@ -74,8 +77,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('848e157f-6bcf-4b2e-a5dd-5124025a8518')
def test_delete_nonexistent_image_metadata_item(self):
- # Negative test: Shouldn't be able to delete metadata
- # item from non-existent image
+ """Test deleting metadata item of a non existence image should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.delete_image_metadata_item,
data_utils.rand_uuid(), 'os_distro')
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 66abb21..8df2e84 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -19,11 +19,16 @@
class KeyPairsV2TestJSON(base.BaseKeypairTest):
+ """Test keypairs API with compute microversion less than 2.2"""
+
max_microversion = '2.1'
@decorators.idempotent_id('1d1dbedb-d7a0-432a-9d09-83f543c3c19b')
def test_keypairs_create_list_delete(self):
- # Keypairs created should be available in the response list
+ """Test create/list/delete keypairs
+
+ Keypairs created should be available in the response list
+ """
# Create 3 keypairs
key_list = list()
for _ in range(3):
@@ -48,7 +53,7 @@
@decorators.idempotent_id('6c1d3123-4519-4742-9194-622cb1714b7d')
def test_keypair_create_delete(self):
- # Keypair should be created, verified and deleted
+ """Test create/delete keypair"""
k_name = data_utils.rand_name('keypair')
keypair = self.create_keypair(k_name)
key_name = keypair['name']
@@ -58,7 +63,7 @@
@decorators.idempotent_id('a4233d5d-52d8-47cc-9a25-e1864527e3df')
def test_get_keypair_detail(self):
- # Keypair should be created, Got details by name and deleted
+ """Test getting keypair detail by keypair name"""
k_name = data_utils.rand_name('keypair')
self.create_keypair(k_name)
keypair_detail = self.keypairs_client.show_keypair(k_name)['keypair']
@@ -68,7 +73,7 @@
@decorators.idempotent_id('39c90c6a-304a-49dd-95ec-2366129def05')
def test_keypair_create_with_pub_key(self):
- # Keypair should be created with a given public key
+ """Test creating keypair with a given public key"""
k_name = data_utils.rand_name('keypair')
pub_key = ("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCs"
"Ne3/1ILNCqFyfYWDeTKLD6jEXC2OQHLmietMWW+/vd"
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 81635ca..40bea3f 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -21,10 +21,12 @@
class KeyPairsNegativeTestJSON(base.BaseKeypairTest):
+ """Negative tests of keypairs API"""
+
@decorators.attr(type=['negative'])
@decorators.idempotent_id('29cca892-46ae-4d48-bc32-8fe7e731eb81')
def test_keypair_create_with_invalid_pub_key(self):
- # Keypair should not be created with a non RSA public key
+ """Test keypair should not be created with a non RSA public key"""
pub_key = "ssh-rsa JUNK nova@ubuntu"
self.assertRaises(lib_exc.BadRequest,
self.create_keypair, pub_key=pub_key)
@@ -32,7 +34,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7cc32e47-4c42-489d-9623-c5e2cb5a2fa5')
def test_keypair_delete_nonexistent_key(self):
- # Non-existent key deletion should throw a proper error
+ """Test non-existent key deletion should throw a proper error"""
k_name = data_utils.rand_name("keypair-non-existent")
self.assertRaises(lib_exc.NotFound,
self.keypairs_client.delete_keypair,
@@ -41,7 +43,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('dade320e-69ca-42a9-ba4a-345300f127e0')
def test_create_keypair_with_empty_public_key(self):
- # Keypair should not be created with an empty public key
+ """Test keypair should not be created with an empty public key"""
pub_key = ' '
self.assertRaises(lib_exc.BadRequest, self.create_keypair,
pub_key=pub_key)
@@ -49,7 +51,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('fc100c19-2926-4b9c-8fdc-d0589ee2f9ff')
def test_create_keypair_when_public_key_bits_exceeds_maximum(self):
- # Keypair should not be created when public key bits are too long
+ """Test keypair should not be created when public key are too long"""
pub_key = 'ssh-rsa ' + 'A' * 2048 + ' openstack@ubuntu'
self.assertRaises(lib_exc.BadRequest, self.create_keypair,
pub_key=pub_key)
@@ -57,7 +59,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0359a7f1-f002-4682-8073-0c91e4011b7c')
def test_create_keypair_with_duplicate_name(self):
- # Keypairs with duplicate names should not be created
+ """Test keypairs with duplicate names should not be created"""
k_name = data_utils.rand_name('keypair')
self.keypairs_client.create_keypair(name=k_name)
# Now try the same keyname to create another key
@@ -68,14 +70,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1398abe1-4a84-45fb-9294-89f514daff00')
def test_create_keypair_with_empty_name_string(self):
- # Keypairs with name being an empty string should not be created
+ """Test keypairs with empty name should not be created"""
self.assertRaises(lib_exc.BadRequest, self.create_keypair,
'')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('3faa916f-779f-4103-aca7-dc3538eee1b7')
def test_create_keypair_with_long_keynames(self):
- # Keypairs with name longer than 255 chars should not be created
+ """Test keypairs with name longer than 255 should not be created"""
k_name = 'keypair-'.ljust(260, '0')
self.assertRaises(lib_exc.BadRequest, self.create_keypair,
k_name)
@@ -83,7 +85,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('45fbe5e0-acb5-49aa-837a-ff8d0719db91')
def test_create_keypair_invalid_name(self):
- # Keypairs with name being an invalid name should not be created
+ """Test keypairs with an invalid name should not be created"""
k_name = r'key_/.\@:'
self.assertRaises(lib_exc.BadRequest, self.create_keypair,
k_name)
diff --git a/tempest/api/compute/keypairs/test_keypairs_v22.py b/tempest/api/compute/keypairs/test_keypairs_v22.py
index 1aff262..e229c37 100644
--- a/tempest/api/compute/keypairs/test_keypairs_v22.py
+++ b/tempest/api/compute/keypairs/test_keypairs_v22.py
@@ -18,6 +18,8 @@
class KeyPairsV22TestJSON(test_keypairs.KeyPairsV2TestJSON):
+ """Test keypairs API with compute microversion greater than 2.1"""
+
min_microversion = '2.2'
max_microversion = 'latest'
@@ -43,9 +45,11 @@
@decorators.idempotent_id('8726fa85-7f98-4b20-af9e-f710a4f3391c')
def test_keypairsv22_create_list_show(self):
+ """Test create/list/show keypair"""
self._test_keypairs_create_list_show()
@decorators.idempotent_id('89d59d43-f735-441a-abcf-0601727f47b6')
def test_keypairsv22_create_list_show_with_type(self):
+ """Test create/list/show keypair with keypair type"""
keypair_type = 'x509'
self._test_keypairs_create_list_show(keypair_type=keypair_type)
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index 4c99ea6..59848f6 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -18,6 +18,10 @@
class SecurityGroupRulesTestJSON(base.BaseSecurityGroupsTest):
+ """Test security group rules API
+
+ Test security group rules API with compute microversion less than 2.36.
+ """
@classmethod
def setup_clients(cls):
@@ -55,8 +59,7 @@
@decorators.attr(type='smoke')
@decorators.idempotent_id('850795d7-d4d3-4e55-b527-a774c0123d3a')
def test_security_group_rules_create(self):
- # Positive test: Creation of Security Group rule
- # should be successful
+ """Test creating security group rules"""
# Creating a Security Group to add rules to it
security_group = self.create_security_group()
securitygroup_id = security_group['id']
@@ -72,10 +75,7 @@
@decorators.idempotent_id('7a01873e-3c38-4f30-80be-31a043cfe2fd')
def test_security_group_rules_create_with_optional_cidr(self):
- # Positive test: Creation of Security Group rule
- # with optional argument cidr
- # should be successful
-
+ """Test creating security group rules with optional field cidr"""
# Creating a Security Group to add rules to it
security_group = self.create_security_group()
parent_group_id = security_group['id']
@@ -94,10 +94,7 @@
@decorators.idempotent_id('7f5d2899-7705-4d4b-8458-4505188ffab6')
def test_security_group_rules_create_with_optional_group_id(self):
- # Positive test: Creation of Security Group rule
- # with optional argument group_id
- # should be successful
-
+ """Test creating security group rules with optional field group id"""
# Creating a Security Group to add rules to it
security_group = self.create_security_group()
parent_group_id = security_group['id']
@@ -122,8 +119,7 @@
@decorators.attr(type='smoke')
@decorators.idempotent_id('a6154130-5a55-4850-8be4-5e9e796dbf17')
def test_security_group_rules_list(self):
- # Positive test: Created Security Group rules should be
- # in the list of all rules
+ """Test listing security group rules"""
# Creating a Security Group to add rules to it
security_group = self.create_security_group()
securitygroup_id = security_group['id']
@@ -159,7 +155,7 @@
@decorators.idempotent_id('fc5c5acf-2091-43a6-a6ae-e42760e9ffaf')
def test_security_group_rules_delete_when_peer_group_deleted(self):
- # Positive test:rule will delete when peer group deleting
+ """Test security group rule gets deleted when peer group is deleted"""
# Creating a Security Group to add rules to it
security_group = self.create_security_group()
sg1_id = security_group['id']
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index 8283aae..3d000ca 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -20,6 +20,11 @@
class SecurityGroupRulesNegativeTestJSON(base.BaseSecurityGroupsTest):
+ """Negative tests of security group rules API
+
+ Negative tests of security group rules API with compute microversion
+ less than 2.36.
+ """
@classmethod
def setup_clients(cls):
@@ -29,8 +34,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1d507e98-7951-469b-82c3-23f1e6b8c254')
def test_create_security_group_rule_with_non_existent_id(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with non existent Parent group id
+ """Test creating security group rule with non existent parent group
+
+ Negative test: Creation of security group rule should fail
+ with non existent parent group id.
+ """
# Adding rules to the non existent Security Group id
parent_group_id = self.generate_random_security_group_id()
ip_protocol = 'tcp'
@@ -45,8 +53,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('2244d7e4-adb7-4ecb-9930-2d77e123ce4f')
def test_create_security_group_rule_with_invalid_id(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with Parent group id which is not integer
+ """Test creating security group rule with invalid parent group id
+
+ Negative test: Creation of security group rule should fail
+ with parent group id which is not integer.
+ """
# Adding rules to the non int Security Group id
parent_group_id = data_utils.rand_name('non_int_id')
ip_protocol = 'tcp'
@@ -61,7 +72,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8bd56d02-3ffa-4d67-9933-b6b9a01d6089')
def test_create_security_group_rule_duplicate(self):
- # Negative test: Create Security Group rule duplicate should fail
+ """Test creating duplicate security group rule should fail"""
# Creating a Security Group to add rule to it
sg = self.create_security_group()
# Adding rules to the created Security Group
@@ -85,8 +96,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('84c81249-9f6e-439c-9bbf-cbb0d2cddbdf')
def test_create_security_group_rule_with_invalid_ip_protocol(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with invalid ip_protocol
+ """Test creating security group rule with invalid ip protocol
+
+ Negative test: Creation of security group rule should fail
+ with invalid ip_protocol.
+ """
# Creating a Security Group to add rule to it
sg = self.create_security_group()
# Adding rules to the created Security Group
@@ -104,8 +118,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('12bbc875-1045-4f7a-be46-751277baedb9')
def test_create_security_group_rule_with_invalid_from_port(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with invalid from_port
+ """Test creating security group rule with invalid from_port
+
+ Negative test: Creation of security group rule should fail
+ with invalid from_port.
+ """
# Creating a Security Group to add rule to it
sg = self.create_security_group()
# Adding rules to the created Security Group
@@ -122,8 +139,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ff88804d-144f-45d1-bf59-dd155838a43a')
def test_create_security_group_rule_with_invalid_to_port(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with invalid to_port
+ """Test creating security group rule with invalid to_port
+
+ Negative test: Creation of security group rule should fail
+ with invalid to_port.
+ """
# Creating a Security Group to add rule to it
sg = self.create_security_group()
# Adding rules to the created Security Group
@@ -140,8 +160,11 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('00296fa9-0576-496a-ae15-fbab843189e0')
def test_create_security_group_rule_with_invalid_port_range(self):
- # Negative test: Creation of Security Group rule should FAIL
- # with invalid port range.
+ """Test creating security group rule with invalid port range
+
+ Negative test: Creation of security group rule should fail
+ with invalid port range.
+ """
# Creating a Security Group to add rule to it.
sg = self.create_security_group()
# Adding a rule to the created Security Group
@@ -158,8 +181,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('56fddcca-dbb8-4494-a0db-96e9f869527c')
def test_delete_security_group_rule_with_non_existent_id(self):
- # Negative test: Deletion of Security Group rule should be FAIL
- # with non existent id
+ """Test deleting non existent security group rule should fail"""
non_existent_rule_id = self.generate_random_security_group_id()
self.assertRaises(lib_exc.NotFound,
self.rules_client.delete_security_group_rule,
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 62d5bea..671a779 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -21,6 +21,7 @@
class SecurityGroupsTestJSON(base.BaseSecurityGroupsTest):
+ """Test security groups API with compute microversion less than 2.36"""
@classmethod
def setup_clients(cls):
@@ -30,7 +31,10 @@
@decorators.attr(type='smoke')
@decorators.idempotent_id('eb2b087d-633d-4d0d-a7bd-9e6ba35b32de')
def test_security_groups_create_list_delete(self):
- # Positive test:Should return the list of Security Groups
+ """Test create/list/delete security groups
+
+ Positive test: Should return the list of security groups.
+ """
# Create 3 Security Groups
security_group_list = []
for _ in range(3):
@@ -60,9 +64,11 @@
@decorators.idempotent_id('ecc0da4a-2117-48af-91af-993cca39a615')
def test_security_group_create_get_delete(self):
- # Security Group should be created, fetched and deleted
- # with char space between name along with
- # leading and trailing spaces
+ """Test create/get/delete security group
+
+ Security group should be created, fetched and deleted
+ with char space between name along with leading and trailing spaces.
+ """
s_name = ' %s ' % data_utils.rand_name('securitygroup ')
securitygroup = self.create_security_group(name=s_name)
securitygroup_name = securitygroup['name']
@@ -80,8 +86,11 @@
@decorators.idempotent_id('fe4abc0d-83f5-4c50-ad11-57a1127297a2')
def test_server_security_groups(self):
- # Checks that security groups may be added and linked to a server
- # and not deleted if the server is active.
+ """Test adding security groups to a server
+
+ Checks that security groups may be added and linked to a server
+ and not deleted if the server is active.
+ """
# Create a couple security groups that we will use
# for the server resource this test creates
sg = self.create_security_group()
@@ -121,7 +130,7 @@
@decorators.idempotent_id('7d4e1d3c-3209-4d6d-b020-986304ebad1f')
def test_update_security_groups(self):
- # Update security group name and description
+ """Test updating security group name and description"""
# Create a security group
securitygroup = self.create_security_group()
securitygroup_id = securitygroup['id']
@@ -139,6 +148,11 @@
@decorators.idempotent_id('79517d60-535a-438f-af3d-e6feab1cbea7')
def test_list_security_groups_by_server(self):
+ """Test listing security groups by server
+
+ Create security groups and add them to a server, then list security
+ groups by server, the added security groups should be in the list.
+ """
# Create a couple security groups that we will use
# for the server resource this test creates
sg = self.create_security_group()
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index 9c44bb2..4607112 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -25,6 +25,11 @@
class SecurityGroupsNegativeTestJSON(base.BaseSecurityGroupsTest):
+ """Negative tests of security groups API
+
+ Negative tests of security groups API with compute microversion
+ less than 2.36.
+ """
@classmethod
def setup_clients(cls):
@@ -34,8 +39,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('673eaec1-9b3e-48ed-bdf1-2786c1b9661c')
def test_security_group_get_nonexistent_group(self):
- # Negative test:Should not be able to GET the details
- # of non-existent Security Group
+ """Test getting non existent security group details should fail"""
non_exist_id = self.generate_random_security_group_id()
self.assertRaises(lib_exc.NotFound, self.client.show_security_group,
non_exist_id)
@@ -45,8 +49,12 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1759c3cb-b0fc-44b7-86ce-c99236be911d')
def test_security_group_create_with_invalid_group_name(self):
- # Negative test: Security Group should not be created with group name
- # as an empty string/with white spaces/chars more than 255
+ """Test creating security group with invalid group name should fail
+
+ Negative test: Security group should not be created with group name
+ as an empty string, or group name with white spaces, or group name
+ with chars more than 255.
+ """
s_description = data_utils.rand_name('description')
# Create Security Group with empty string as group name
self.assertRaises(lib_exc.BadRequest,
@@ -67,9 +75,12 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('777b6f14-aca9-4758-9e84-38783cfa58bc')
def test_security_group_create_with_invalid_group_description(self):
- # Negative test: Security Group should not be created with description
- # longer than 255 chars. Empty description is allowed by the API
- # reference, however.
+ """Test creating security group with invalid group description
+
+ Negative test: Security group should not be created with description
+ longer than 255 chars. Empty description is allowed by the API
+ reference, however.
+ """
s_name = data_utils.rand_name('securitygroup')
# Create Security Group with group description longer than 255 chars
s_description = 'description-'.ljust(260, '0')
@@ -82,8 +93,7 @@
"Neutron allows duplicate names for security groups")
@decorators.attr(type=['negative'])
def test_security_group_create_with_duplicate_name(self):
- # Negative test:Security Group with duplicate name should not
- # be created
+ """Test creating security group with duplicate name should fail"""
s_name = data_utils.rand_name('securitygroup')
s_description = data_utils.rand_name('description')
self.create_security_group(name=s_name, description=s_description)
@@ -95,7 +105,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('36a1629f-c6da-4a26-b8b8-55e7e5d5cd58')
def test_delete_the_default_security_group(self):
- # Negative test:Deletion of the "default" Security Group should Fail
+ """Test deleting "default" security group should fail"""
default_security_group_id = None
body = self.client.list_security_groups()['security_groups']
for i in range(len(body)):
@@ -110,7 +120,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6727c00b-214c-4f9e-9a52-017ac3e98411')
def test_delete_nonexistent_security_group(self):
- # Negative test:Deletion of a non-existent Security Group should fail
+ """Test deleting non existent security group should fail"""
non_exist_id = self.generate_random_security_group_id()
self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group, non_exist_id)
@@ -118,8 +128,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1438f330-8fa4-4aeb-8a94-37c250106d7f')
def test_delete_security_group_without_passing_id(self):
- # Negative test:Deletion of a Security Group with out passing ID
- # should Fail
+ """Test deleting security group passing empty group id should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.delete_security_group, '')
@@ -128,7 +137,7 @@
"Neutron does not check the security group ID")
@decorators.attr(type=['negative'])
def test_update_security_group_with_invalid_sg_id(self):
- # Update security_group with invalid sg_id should fail
+ """Test updating security group with invalid group id should fail"""
s_name = data_utils.rand_name('sg')
s_description = data_utils.rand_name('description')
# Create a non int sg_id
@@ -142,7 +151,7 @@
"Neutron does not check the security group name")
@decorators.attr(type=['negative'])
def test_update_security_group_with_invalid_sg_name(self):
- # Update security_group with invalid sg_name should fail
+ """Test updating security group to invalid group name should fail"""
securitygroup = self.create_security_group()
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
@@ -156,7 +165,7 @@
"Neutron does not check the security group description")
@decorators.attr(type=['negative'])
def test_update_security_group_with_invalid_sg_des(self):
- # Update security_group with invalid sg_des should fail
+ """Test updating security group to invalid description should fail"""
securitygroup = self.create_security_group()
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
@@ -168,7 +177,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('27edee9c-873d-4da6-a68a-3c256efebe8f')
def test_update_non_existent_security_group(self):
- # Update a non-existent Security Group should Fail
+ """Test updating a non existent security group should fail"""
non_exist_id = self.generate_random_security_group_id()
s_name = data_utils.rand_name('sg')
s_description = data_utils.rand_name('description')
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index c1af6c7..0601bbe 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -99,6 +99,7 @@
class AttachInterfacesTestJSON(AttachInterfacesTestBase):
+ """Test attaching interfaces"""
def wait_for_port_detach(self, port_id):
"""Waits for the port's device_id to be unset.
@@ -230,6 +231,7 @@
@decorators.idempotent_id('73fe8f02-590d-4bf1-b184-e9ca81065051')
@utils.services('network')
def test_create_list_show_delete_interfaces_by_network_port(self):
+ """Test create/list/show/delete interfaces by network port"""
server, ifs, _ = self._create_server_get_interfaces()
interface_count = len(ifs)
self.assertGreater(interface_count, 0)
@@ -262,6 +264,7 @@
@decorators.idempotent_id('d290c06c-f5b3-11e7-8ec8-002293781009')
@utils.services('network')
def test_create_list_show_delete_interfaces_by_fixed_ip(self):
+ """Test create/list/show/delete interfaces by fixed ip"""
# NOTE(zhufl) By default only project that is admin or network owner
# or project with role advsvc is authorised to create interfaces with
# fixed-ip, so if we don't create network for each project, do not
@@ -290,7 +293,7 @@
@decorators.idempotent_id('2f3a0127-95c7-4977-92d2-bc5aec602fb4')
def test_reassign_port_between_servers(self):
- """Tests the following:
+ """Tests reassigning port between servers
1. Create a port in Neutron.
2. Create two servers in Nova.
@@ -343,12 +346,15 @@
class AttachInterfacesUnderV243Test(AttachInterfacesTestBase):
+ """Test attaching interfaces with compute microversion less than 2.44"""
+
max_microversion = '2.43'
@decorators.attr(type='smoke')
@decorators.idempotent_id('c7e0e60b-ee45-43d0-abeb-8596fd42a2f9')
@utils.services('network')
def test_add_remove_fixed_ip(self):
+ """Test adding and removing fixed ip from server"""
# NOTE(zhufl) By default only project that is admin or network owner
# or project with role advsvc is authorised to add interfaces with
# fixed-ip, so if we don't create network for each project, do not
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 8879369..a7e2187 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -103,6 +103,7 @@
class TaggedBootDevicesTest(DeviceTaggingBase):
+ """Test tagged boot device with compute microversion equals 2.32"""
min_microversion = '2.32'
# NOTE(mriedem): max_version looks odd but it's actually correct. Due to a
@@ -149,6 +150,16 @@
@decorators.idempotent_id('a2e65a6c-66f1-4442-aaa8-498c31778d96')
@utils.services('network', 'volume', 'image')
def test_tagged_boot_devices(self):
+ """Test tagged boot devices
+
+ 1. Create volumes
+ 2. Create networks
+ 3. Create subnets
+ 4. Create ports
+ 5. Create server, specifying tags for items in networks and
+ block_device_mapping_v2,
+ 6. Verify tagged devices are in server via metadata service
+ """
# Create volumes
# The create_volume methods waits for the volumes to be available and
# the base class will clean them up on tearDown.
@@ -300,11 +311,14 @@
class TaggedBootDevicesTest_v242(TaggedBootDevicesTest):
+ """Test tagged boot devices with compute microversion greater than 2.41"""
+
min_microversion = '2.42'
max_microversion = 'latest'
class TaggedAttachmentsTest(DeviceTaggingBase):
+ """Test tagged attachments with compute microversion greater than 2.48"""
min_microversion = '2.49'
max_microversion = 'latest'
@@ -342,6 +356,16 @@
@decorators.idempotent_id('3e41c782-2a89-4922-a9d2-9a188c4e7c7c')
@utils.services('network', 'volume', 'image')
def test_tagged_attachment(self):
+ """Test tagged attachment
+
+ 1. Create network
+ 2. Create subnet
+ 3. Create volume
+ 4. Create server
+ 5. Attach tagged networks and volume
+ 6. Verify tagged devices are in server via metadata service
+ 7. Detach tagged networks and volume
+ """
# Create network
net = self.networks_client.create_network(
name=data_utils.rand_name(
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 00837eb..5ab592a 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -19,6 +19,8 @@
class InstanceActionsTestJSON(base.BaseV2ComputeTest):
+ """Test instance actions API"""
+
create_default_network = True
@classmethod
@@ -34,7 +36,7 @@
@decorators.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
- # List actions of the provided server
+ """Test listing actions of the provided server"""
self.client.reboot_server(self.server['id'], type='HARD')
waiters.wait_for_server_status(self.client,
self.server['id'], 'ACTIVE')
@@ -47,7 +49,7 @@
@decorators.idempotent_id('aacc71ca-1d70-4aa5-bbf6-0ff71470e43c')
def test_get_instance_action(self):
- # Get the action details of the provided server
+ """Test getting the action details of the provided server"""
body = self.client.show_instance_action(
self.server['id'], self.request_id)['instanceAction']
self.assertEqual(self.server['id'], body['instance_uuid'])
@@ -55,6 +57,8 @@
class InstanceActionsV221TestJSON(base.BaseV2ComputeTest):
+ """Test instance actions with compute microversion greater than 2.20"""
+
create_default_network = True
min_microversion = '2.21'
@@ -67,8 +71,11 @@
@decorators.idempotent_id('0a0f85d4-10fa-41f6-bf80-a54fb4aa2ae1')
def test_get_list_deleted_instance_actions(self):
+ """Test listing actions for deleted instance
- # List actions of the deleted server
+ Listing actions for deleted instance should succeed and the returned
+ actions should contain 'create' and 'delete'.
+ """
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
diff --git a/tempest/api/compute/servers/test_instance_actions_negative.py b/tempest/api/compute/servers/test_instance_actions_negative.py
index 4b5a2c3..dd2bf06 100644
--- a/tempest/api/compute/servers/test_instance_actions_negative.py
+++ b/tempest/api/compute/servers/test_instance_actions_negative.py
@@ -20,6 +20,8 @@
class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
+ """Negative tests of instance actions"""
+
create_default_network = True
@classmethod
@@ -35,7 +37,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('67e1fce6-7ec2-45c6-92d4-0a8f1a632910')
def test_list_instance_actions_non_existent_server(self):
- # List actions of the non-existent server id
+ """Test listing actions for non existent instance should fail"""
non_existent_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.list_instance_actions,
@@ -44,6 +46,6 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0269f40a-6f18-456c-b336-c03623c897f1')
def test_get_instance_action_invalid_request(self):
- # Get the action details of the provided server with invalid request
+ """Test getting instance action with invalid request_id should fail"""
self.assertRaises(lib_exc.NotFound, self.client.show_instance_action,
self.server['id'], '999')
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 1247494..5445113 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -53,9 +53,11 @@
class ServerRescueTestJSON(ServerRescueTestBase):
+ """Test server rescue"""
@decorators.idempotent_id('fd032140-714c-42e4-a8fd-adcd8df06be6')
def test_rescue_unrescue_instance(self):
+ """Test rescue/unrescue server"""
password = data_utils.rand_password()
server = self.create_test_server(adminPass=password,
wait_until='ACTIVE')
@@ -68,6 +70,7 @@
class ServerRescueTestJSONUnderV235(ServerRescueTestBase):
+ """Test server rescue with compute microversion less than 2.36"""
max_microversion = '2.35'
@@ -81,7 +84,7 @@
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
"Floating ips are not available")
def test_rescued_vm_associate_dissociate_floating_ip(self):
- # Association of floating IP to a rescued vm
+ """Test associate/dissociate floating ip for rescued server"""
floating_ip_body = self.floating_ips_client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
self.addCleanup(self.floating_ips_client.delete_floating_ip,
@@ -96,6 +99,7 @@
@decorators.idempotent_id('affca41f-7195-492d-8065-e09eee245404')
def test_rescued_vm_add_remove_security_group(self):
+ """Test add/remove security group to for rescued server"""
# Add Security group
sg = self.create_security_group()
self.servers_client.add_security_group(self.rescued_server_id,
@@ -154,33 +158,43 @@
class ServerStableDeviceRescueTest(BaseServerStableDeviceRescueTest):
+ """Test rescuing server specifying type of device for the rescue disk"""
@decorators.idempotent_id('947004c3-e8ef-47d9-9f00-97b74f9eaf96')
def test_stable_device_rescue_cdrom_ide(self):
+ """Test rescuing server with cdrom and ide as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='cdrom', hw_rescue_bus='ide')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('16865750-1417-4854-bcf7-496e6753c01e')
def test_stable_device_rescue_disk_virtio(self):
+ """Test rescuing server with disk and virtio as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='virtio')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('12340157-6306-4745-bdda-cfa019908b48')
def test_stable_device_rescue_disk_scsi(self):
+ """Test rescuing server with disk and scsi as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='scsi')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('647d04cf-ad35-4956-89ab-b05c5c16f30c')
def test_stable_device_rescue_disk_usb(self):
+ """Test rescuing server with disk and usb as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='usb')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('a3772b42-00bf-4310-a90b-1cc6fd3e7eab')
def test_stable_device_rescue_disk_virtio_with_volume_attached(self):
+ """Test rescuing server with volume attached
+
+ Attach a volume to the server and then rescue the server with disk
+ and virtio as the rescue disk.
+ """
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='virtio')
server = self.servers_client.show_server(server_id)['server']
@@ -192,12 +206,22 @@
class ServerBootFromVolumeStableRescueTest(BaseServerStableDeviceRescueTest):
+ """Test rescuing server specifying type of device for the rescue disk
+
+ Test rescuing server specifying type of device for the rescue disk with
+ compute microversion greater than 2.86.
+ """
min_microversion = '2.87'
@decorators.attr(type='slow')
@decorators.idempotent_id('48f123cb-922a-4065-8db6-b9a9074a556b')
def test_stable_device_rescue_bfv_blank_volume(self):
+ """Test rescuing server with blank volume as block_device_mapping_v2
+
+ Create a server with block_device_mapping_v2 with blank volume,
+ then rescue the server with disk and virtio as the rescue disk.
+ """
block_device_mapping_v2 = [{
"boot_index": "0",
"source_type": "blank",
@@ -211,6 +235,11 @@
@decorators.attr(type='slow')
@decorators.idempotent_id('e4636333-c928-40fc-98b7-70a23eef4224')
def test_stable_device_rescue_bfv_image_volume(self):
+ """Test rescuing server with blank volume as block_device_mapping_v2
+
+ Create a server with block_device_mapping_v2 with image volume,
+ then rescue the server with disk and virtio as the rescue disk.
+ """
block_device_mapping_v2 = [{
"boot_index": "0",
"source_type": "image",
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 12e7fea..3318876 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -27,10 +27,11 @@
class ExtensionsTest(base.BaseV2ComputeTest):
+ """Tests Compute Extensions API"""
@decorators.idempotent_id('3bb27738-b759-4e0d-a5fa-37d7a6df07d1')
def test_list_extensions(self):
- # List of all extensions
+ """Test listing compute extensions"""
if not CONF.compute_feature_enabled.api_extensions:
raise self.skipException('There are not any extensions configured')
extensions = self.extensions_client.list_extensions()['extensions']
@@ -50,6 +51,6 @@
@decorators.idempotent_id('05762f39-bdfa-4cdb-9b46-b78f8e78e2fd')
@utils.requires_ext(extension='os-consoles', service='compute')
def test_get_extension(self):
- # get the specified extensions
+ """Test getting specified compute extension details"""
extension = self.extensions_client.show_extension('os-consoles')
self.assertEqual('os-consoles', extension['extension']['alias'])
diff --git a/tempest/api/compute/test_networks.py b/tempest/api/compute/test_networks.py
index 76131e2..97c26e4 100644
--- a/tempest/api/compute/test_networks.py
+++ b/tempest/api/compute/test_networks.py
@@ -20,6 +20,7 @@
class ComputeNetworksTest(base.BaseV2ComputeTest):
+ """Test compute networks API with compute microversion less than 2.36"""
max_microversion = '2.35'
@classmethod
@@ -35,5 +36,6 @@
@decorators.idempotent_id('3fe07175-312e-49a5-a623-5f52eeada4c2')
def test_list_networks(self):
+ """Test listing networks using compute networks API"""
networks = self.client.list_networks()['networks']
self.assertNotEmpty(networks, "No networks found.")
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index a62492d..5fe0e3b 100644
--- a/tempest/api/compute/test_quotas.py
+++ b/tempest/api/compute/test_quotas.py
@@ -20,6 +20,7 @@
class QuotasTestJSON(base.BaseV2ComputeTest):
+ """Test compute quotas"""
@classmethod
def skip_checks(cls):
@@ -59,7 +60,7 @@
@decorators.idempotent_id('f1ef0a97-dbbb-4cca-adc5-c9fbc4f76107')
def test_get_quotas(self):
- # User can get the quota set for it's tenant
+ """Test user can get the compute quota set for it's project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = self.client.show_quota_set(self.tenant_id)['quota_set']
self.assertEqual(quota_set['id'], self.tenant_id)
@@ -75,7 +76,7 @@
@decorators.idempotent_id('9bfecac7-b966-4f47-913f-1a9e2c12134a')
def test_get_default_quotas(self):
- # User can get the default quota set for it's tenant
+ """Test user can get the default compute quota set for it's project"""
expected_quota_set = self.default_quota_set | set(['id'])
quota_set = (self.client.show_default_quota_set(self.tenant_id)
['quota_set'])
@@ -85,7 +86,7 @@
@decorators.idempotent_id('cd65d997-f7e4-4966-a7e9-d5001b674fdc')
def test_compare_tenant_quotas_with_default_quotas(self):
- # Tenants are created with the default quota values
+ """Test tenants are created with the default compute quota values"""
default_quota_set = \
self.client.show_default_quota_set(self.tenant_id)['quota_set']
tenant_quota_set = (self.client.show_quota_set(self.tenant_id)
diff --git a/tempest/api/compute/test_tenant_networks.py b/tempest/api/compute/test_tenant_networks.py
index f4eada0..17f4b80 100644
--- a/tempest/api/compute/test_tenant_networks.py
+++ b/tempest/api/compute/test_tenant_networks.py
@@ -18,6 +18,8 @@
class ComputeTenantNetworksTest(base.BaseV2ComputeTest):
+ """Test compute tenant networks API with microversion less than 2.36"""
+
max_microversion = '2.35'
@classmethod
@@ -34,8 +36,11 @@
@decorators.idempotent_id('edfea98e-bbe3-4c7a-9739-87b986baff26')
@utils.services('network')
def test_list_show_tenant_networks(self):
- # Fetch all networks that are visible to the tenant: this may include
- # shared and external networks
+ """Test list/show tenant networks
+
+ Fetch all networks that are visible to the tenant: this may include
+ shared and external networks.
+ """
tenant_networks = [
n['id'] for n in self.client.list_tenant_networks()['networks']
]
diff --git a/tempest/api/compute/volumes/test_attach_volume_negative.py b/tempest/api/compute/volumes/test_attach_volume_negative.py
index 9a506af..516f599 100644
--- a/tempest/api/compute/volumes/test_attach_volume_negative.py
+++ b/tempest/api/compute/volumes/test_attach_volume_negative.py
@@ -21,6 +21,8 @@
class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
+ """Negative tests of volume attaching"""
+
create_default_network = True
@classmethod
@@ -34,6 +36,7 @@
@decorators.related_bug('1630783', status_code=500)
@decorators.idempotent_id('a313b5cd-fbd0-49cc-94de-870e99f763c7')
def test_delete_attached_volume(self):
+ """Test deleting attachemd volume should fail"""
server = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()
self.attach_volume(server, volume)
@@ -44,10 +47,13 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('aab919e2-d992-4cbb-a4ed-745c2475398c')
def test_attach_attached_volume_to_same_server(self):
- # Test attaching the same volume to the same instance once
- # it's already attached. The nova/cinder validation for this differs
- # depending on whether or not cinder v3.27 is being used to attach
- # the volume to the instance.
+ """Test attaching attached volume to same server should fail
+
+ Test attaching the same volume to the same instance once
+ it's already attached. The nova/cinder validation for this differs
+ depending on whether or not cinder v3.27 is being used to attach
+ the volume to the instance.
+ """
server = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()
@@ -59,6 +65,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ee37a796-2afb-11e7-bc0f-fa163e65f5ce')
def test_attach_attached_volume_to_different_server(self):
+ """Test attaching attached volume to different server should fail"""
server1 = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()
diff --git a/tempest/api/network/admin/test_ports.py b/tempest/api/network/admin/test_ports.py
index 51f2857..5f9f29f 100644
--- a/tempest/api/network/admin/test_ports.py
+++ b/tempest/api/network/admin/test_ports.py
@@ -48,6 +48,8 @@
"name": data_utils.rand_name(self.__class__.__name__)}
body = self.admin_ports_client.create_port(**post_body)
port = body['port']
+ self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(
test_utils.call_and_ignore_notfound_exc,
self.admin_ports_client.delete_port, port['id'])
@@ -63,6 +65,8 @@
"name": data_utils.rand_name(self.__class__.__name__)}
body = self.admin_ports_client.create_port(**post_body)
port = body['port']
+ self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(
test_utils.call_and_ignore_notfound_exc,
self.admin_ports_client.delete_port, port['id'])
@@ -82,6 +86,8 @@
"name": data_utils.rand_name(self.__class__.__name__)}
body = self.admin_ports_client.create_port(**post_body)
port = body['port']
+ self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(
test_utils.call_and_ignore_notfound_exc,
self.admin_ports_client.delete_port, port['id'])
@@ -110,6 +116,8 @@
name=data_utils.rand_name(self.__class__.__name__),
network_id=self.network['id'])
port = body['port']
+ self.addCleanup(self.admin_ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.admin_ports_client.delete_port, port['id'])
body = self.admin_ports_client.show_port(port['id'])
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index c6d049a..479578d 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -77,6 +77,8 @@
name=data_utils.rand_name(self.__class__.__name__))
port = body['port']
# Schedule port deletion with verification upon test completion
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(self._delete_port, port['id'])
self.assertTrue(port['admin_state_up'])
# Verify port update
@@ -99,6 +101,10 @@
created_ports = body['ports']
port1 = created_ports[0]
port2 = created_ports[1]
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port1['id'])
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port2['id'])
self.addCleanup(self._delete_port, port1['id'])
self.addCleanup(self._delete_port, port2['id'])
self.assertEqual(port1['network_id'], network1['id'])
@@ -126,6 +132,8 @@
body = self.ports_client.create_port(
network_id=net_id,
name=data_utils.rand_name(self.__class__.__name__))
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ body['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, body['port']['id'])
port = body['port']
@@ -183,11 +191,15 @@
port_1 = self.ports_client.create_port(
network_id=network['id'],
name=data_utils.rand_name(self.__class__.__name__))
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port_1['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port_1['port']['id'])
port_2 = self.ports_client.create_port(
network_id=network['id'],
name=data_utils.rand_name(self.__class__.__name__))
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port_2['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port_2['port']['id'])
# List ports filtered by fixed_ips
@@ -241,6 +253,8 @@
network_id=network['id'],
name=data_utils.rand_name(self.__class__.__name__),
fixed_ips=fixed_ips)
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port_1['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port_1['port']['id'])
fixed_ips = [{'subnet_id': subnet['id'], 'ip_address': ip_address_2}]
@@ -248,6 +262,8 @@
network_id=network['id'],
name=data_utils.rand_name(self.__class__.__name__),
fixed_ips=fixed_ips)
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port_2['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port_2['port']['id'])
@@ -307,6 +323,8 @@
# Add router interface to port created above
self.routers_client.add_router_interface(router['id'],
port_id=port['port']['id'])
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.routers_client.remove_router_interface,
router['id'], port_id=port['port']['id'])
@@ -343,6 +361,8 @@
# Create a port with multiple IP addresses
port = self.create_port(network,
fixed_ips=fixed_ips)
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port['id'])
self.assertEqual(2, len(port['fixed_ips']))
@@ -386,6 +406,8 @@
"admin_state_up": True,
"fixed_ips": fixed_ip_1}
body = self.ports_client.create_port(**post_body)
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ body['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, body['port']['id'])
port = body['port']
@@ -456,6 +478,8 @@
network_id=self.network['id'],
mac_address=free_mac_address,
name=data_utils.rand_name(self.__class__.__name__))
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ body['port']['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, body['port']['id'])
port = body['port']
@@ -474,6 +498,8 @@
network = self._create_network()
self._create_subnet(network)
port = self.create_port(network, security_groups=[])
+ self.addCleanup(self.ports_client.wait_for_resource_deletion,
+ port['id'])
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.ports_client.delete_port, port['id'])
self.assertIsNotNone(port['security_groups'])
diff --git a/tempest/api/object_storage/test_account_bulk.py b/tempest/api/object_storage/test_account_bulk.py
index 80f790f..687fe57 100644
--- a/tempest/api/object_storage/test_account_bulk.py
+++ b/tempest/api/object_storage/test_account_bulk.py
@@ -21,6 +21,7 @@
class BulkTest(base.BaseObjectTest):
+ """Test bulk operation of archived file"""
def setUp(self):
super(BulkTest, self).setUp()
@@ -70,7 +71,7 @@
@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 @@
@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 @@
@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 48f42ec..6854bbe 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -22,6 +22,7 @@
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 @@
@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 3e664d7..8d2a501 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 @@
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 @@
@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 e9ca0b1..c8731fe 100644
--- a/tempest/api/object_storage/test_container_acl.py
+++ b/tempest/api/object_storage/test_container_acl.py
@@ -22,6 +22,7 @@
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 @@
@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 @@
@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_acl_negative.py b/tempest/api/object_storage/test_container_acl_negative.py
index 90b24b4..73d7f27 100644
--- a/tempest/api/object_storage/test_container_acl_negative.py
+++ b/tempest/api/object_storage/test_container_acl_negative.py
@@ -22,6 +22,7 @@
class ObjectACLsNegativeTest(base.BaseObjectTest):
+ """Negative tests of object ACLs"""
credentials = [['operator', CONF.object_storage.operator_role],
['operator_alt', CONF.object_storage.operator_role]]
@@ -48,6 +49,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('af587587-0c24-4e15-9822-8352ce711013')
def test_write_object_without_using_creds(self):
+ """Test writing object without using credentials"""
# trying to create object with empty headers
# X-Auth-Token is not provided
object_name = data_utils.rand_name(name='Object')
@@ -62,6 +64,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('af85af0b-a025-4e72-a90e-121babf55720')
def test_delete_object_without_using_creds(self):
+ """Test deleting object without using credentials"""
# create object
object_name = data_utils.rand_name(name='Object')
self.object_client.create_object(self.container_name, object_name,
@@ -79,7 +82,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('63d84e37-55a6-42e2-9e5f-276e60e26a00')
def test_write_object_with_non_authorized_user(self):
- # attempt to upload another file using non-authorized user
+ """Test writing object with non-authorized user"""
# User provided token is forbidden. ACL are not set
object_name = data_utils.rand_name(name='Object')
# trying to create object with non-authorized user
@@ -94,7 +97,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('abf63359-be52-4feb-87dd-447689fc77fd')
def test_read_object_with_non_authorized_user(self):
- # attempt to read object using non-authorized user
+ """Test reading object with non-authorized user"""
# User provided token is forbidden. ACL are not set
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(
@@ -112,7 +115,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7343ac3d-cfed-4198-9bb0-00149741a492')
def test_delete_object_with_non_authorized_user(self):
- # attempt to delete object using non-authorized user
+ """Test deleting object with non-authorized user"""
# User provided token is forbidden. ACL are not set
object_name = data_utils.rand_name(name='Object')
resp, _ = self.object_client.create_object(
@@ -130,7 +133,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9ed01334-01e9-41ea-87ea-e6f465582823')
def test_read_object_without_rights(self):
- # attempt to read object using non-authorized user
+ """Test reading object without rights"""
# update X-Container-Read metadata ACL
cont_headers = {'X-Container-Read': 'badtenant:baduser'}
resp_meta, _ = (
@@ -155,7 +158,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a3a585a7-d8cf-4b65-a1a0-edc2b1204f85')
def test_write_object_without_rights(self):
- # attempt to write object using non-authorized user
+ """Test writing object without rights"""
# update X-Container-Write metadata ACL
cont_headers = {'X-Container-Write': 'badtenant:baduser'}
resp_meta, _ = (
@@ -177,7 +180,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8ba512ad-aa6e-444e-b882-2906a0ea2052')
def test_write_object_without_write_rights(self):
- # attempt to write object using non-authorized user
+ """Test writing object without write rights"""
# update X-Container-Read and X-Container-Write metadata ACL
tenant_name = self.os_operator.credentials.tenant_name
username = self.os_operator.credentials.username
@@ -203,7 +206,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b4e366f8-f185-47ab-b789-df4416f9ecdb')
def test_delete_object_without_write_rights(self):
- # attempt to delete object using non-authorized user
+ """Test deleting object without write rights"""
# update X-Container-Read and X-Container-Write metadata ACL
tenant_name = self.os_operator.credentials.tenant_name
username = self.os_operator.credentials.username
diff --git a/tempest/api/object_storage/test_container_services.py b/tempest/api/object_storage/test_container_services.py
index cdc420e..7ad6f6f 100644
--- a/tempest/api/object_storage/test_container_services.py
+++ b/tempest/api/object_storage/test_container_services.py
@@ -19,6 +19,8 @@
class ContainerTest(base.BaseObjectTest):
+ """Test containers"""
+
def tearDown(self):
self.delete_containers()
super(ContainerTest, self).tearDown()
@@ -26,6 +28,7 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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_container_services_negative.py b/tempest/api/object_storage/test_container_services_negative.py
index b8c83b7..31c33db 100644
--- a/tempest/api/object_storage/test_container_services_negative.py
+++ b/tempest/api/object_storage/test_container_services_negative.py
@@ -25,6 +25,7 @@
class ContainerNegativeTest(base.BaseObjectTest):
+ """Negative tests of containers"""
@classmethod
def resource_setup(cls):
@@ -41,7 +42,7 @@
CONF.object_storage_feature_enabled.discoverability,
'Discoverability function is disabled')
def test_create_container_name_exceeds_max_length(self):
- # Attempts to create a container name that is longer than max
+ """Test creating container with name longer than max"""
max_length = self.constraints['max_container_name_length']
# create a container with long name
container_name = data_utils.arbitrary_string(size=max_length + 1)
@@ -58,8 +59,7 @@
CONF.object_storage_feature_enabled.discoverability,
'Discoverability function is disabled')
def test_create_container_metadata_name_exceeds_max_length(self):
- # Attempts to create container with metadata name
- # that is longer than max.
+ """Test creating container with metadata name longer than max"""
max_length = self.constraints['max_meta_name_length']
container_name = data_utils.rand_name(name='TestContainer')
metadata_name = 'X-Container-Meta-' + data_utils.arbitrary_string(
@@ -77,8 +77,7 @@
CONF.object_storage_feature_enabled.discoverability,
'Discoverability function is disabled')
def test_create_container_metadata_value_exceeds_max_length(self):
- # Attempts to create container with metadata value
- # that is longer than max.
+ """Test creating container with metadata value longer than max"""
max_length = self.constraints['max_meta_value_length']
container_name = data_utils.rand_name(name='TestContainer')
metadata_value = data_utils.arbitrary_string(size=max_length + 1)
@@ -95,8 +94,7 @@
CONF.object_storage_feature_enabled.discoverability,
'Discoverability function is disabled')
def test_create_container_metadata_exceeds_overall_metadata_count(self):
- # Attempts to create container with metadata that exceeds the
- # default count
+ """Test creating container with metadata exceeding default count"""
max_count = self.constraints['max_meta_count']
container_name = data_utils.rand_name(name='TestContainer')
metadata = {}
@@ -113,8 +111,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('1a95ab2e-b712-4a98-8a4d-8ce21b7557d6')
def test_get_metadata_headers_with_invalid_container_name(self):
- # Attempts to retrieve metadata headers with an invalid
- # container name.
+ """Test getting metadata headers with invalid container name"""
self.assertRaises(exceptions.NotFound,
self.container_client.list_container_metadata,
'invalid_container_name')
@@ -122,7 +119,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('125a24fa-90a7-4cfc-b604-44e49d788390')
def test_update_metadata_with_nonexistent_container_name(self):
- # Attempts to update metadata using a nonexistent container name.
+ """Test updating metadata using a nonexistent container name"""
metadata = {'animal': 'penguin'}
self.assertRaises(
@@ -133,7 +130,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('65387dbf-a0e2-4aac-9ddc-16eb3f1f69ba')
def test_delete_with_nonexistent_container_name(self):
- # Attempts to delete metadata using a nonexistent container name.
+ """Test deleting metadata using a non existent container name"""
metadata = {'animal': 'penguin'}
self.assertRaises(
@@ -144,8 +141,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('14331d21-1e81-420a-beea-19cb5e5207f5')
def test_list_all_container_objects_with_nonexistent_container(self):
- # Attempts to get a listing of all objects on a container
- # that doesn't exist.
+ """Test getting a list of all objects on a non existent container"""
params = {'limit': 9999, 'format': 'json'}
self.assertRaises(exceptions.NotFound,
self.container_client.list_container_objects,
@@ -154,8 +150,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('86b2ab08-92d5-493d-acd2-85f0c848819e')
def test_list_all_container_objects_on_deleted_container(self):
- # Attempts to get a listing of all objects on a container
- # that was deleted.
+ """Test getting a list of all objects on a deleted container"""
container_name = self.create_container()
# delete container
resp, _ = self.container_client.delete_container(container_name)
@@ -168,6 +163,7 @@
@decorators.attr(type=["negative"])
@decorators.idempotent_id('42da116e-1e8c-4c96-9e06-2f13884ed2b1')
def test_delete_non_empty_container(self):
+ """Test deleting a container with object in it"""
# create a container and an object within it
# attempt to delete a container that isn't empty.
container_name = self.create_container()
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 1243b83..ef98ed8 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -21,6 +21,7 @@
class StaticWebTest(base.BaseObjectTest):
+ """Test static web"""
@classmethod
def resource_setup(cls):
@@ -47,6 +48,7 @@
@decorators.idempotent_id('c1f055ab-621d-4a6a-831f-846fcb578b8b')
@utils.requires_ext(extension='staticweb', service='object')
def test_web_index(self):
+ """Test web index"""
headers = {'web-index': self.object_name}
self.container_client.create_update_or_delete_container_metadata(
@@ -79,6 +81,7 @@
@decorators.idempotent_id('941814cf-db9e-4b21-8112-2b6d0af10ee5')
@utils.requires_ext(extension='staticweb', service='object')
def test_web_listing(self):
+ """Test web listing"""
headers = {'web-listings': 'true'}
self.container_client.create_update_or_delete_container_metadata(
@@ -111,6 +114,7 @@
@decorators.idempotent_id('bc37ec94-43c8-4990-842e-0e5e02fc8926')
@utils.requires_ext(extension='staticweb', service='object')
def test_web_listing_css(self):
+ """Test web listing css"""
headers = {'web-listings': 'true',
'web-listings-css': 'listings.css'}
@@ -134,6 +138,7 @@
@decorators.idempotent_id('f18b4bef-212e-45e7-b3ca-59af3a465f82')
@utils.requires_ext(extension='staticweb', service='object')
def test_web_error(self):
+ """Test web error"""
headers = {'web-listings': 'true',
'web-error': self.object_name}
diff --git a/tempest/api/object_storage/test_healthcheck.py b/tempest/api/object_storage/test_healthcheck.py
index 8e9e406..f5e2443 100644
--- a/tempest/api/object_storage/test_healthcheck.py
+++ b/tempest/api/object_storage/test_healthcheck.py
@@ -19,12 +19,14 @@
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_formpost.py b/tempest/api/object_storage/test_object_formpost.py
index cd834bf..d857d3b 100644
--- a/tempest/api/object_storage/test_object_formpost.py
+++ b/tempest/api/object_storage/test_object_formpost.py
@@ -25,6 +25,7 @@
class ObjectFormPostTest(base.BaseObjectTest):
+ """Test object post with form"""
metadata = {}
containers = []
@@ -110,6 +111,7 @@
@decorators.idempotent_id('80fac02b-6e54-4f7b-be0d-a965b5cbef76')
@utils.requires_ext(extension='formpost', service='object')
def test_post_object_using_form(self):
+ """Test posting object using form"""
body, content_type = self.get_multipart_form()
headers = {'Content-Type': content_type,
diff --git a/tempest/api/object_storage/test_object_formpost_negative.py b/tempest/api/object_storage/test_object_formpost_negative.py
index df6a0fd..0499eef 100644
--- a/tempest/api/object_storage/test_object_formpost_negative.py
+++ b/tempest/api/object_storage/test_object_formpost_negative.py
@@ -26,6 +26,7 @@
class ObjectFormPostNegativeTest(base.BaseObjectTest):
+ """Negative tests of object post with form"""
metadata = {}
containers = []
@@ -112,6 +113,7 @@
@utils.requires_ext(extension='formpost', service='object')
@decorators.attr(type=['negative'])
def test_post_object_using_form_expired(self):
+ """Test posting object using expired form"""
body, content_type = self.get_multipart_form(expires=1)
time.sleep(2)
@@ -129,6 +131,7 @@
@utils.requires_ext(extension='formpost', service='object')
@decorators.attr(type=['negative'])
def test_post_object_using_form_invalid_signature(self):
+ """Test posting object using form with invalid signature"""
self.key = "Wrong"
body, content_type = self.get_multipart_form()
diff --git a/tempest/api/object_storage/test_object_temp_url.py b/tempest/api/object_storage/test_object_temp_url.py
index b99f93a..29354b6 100644
--- a/tempest/api/object_storage/test_object_temp_url.py
+++ b/tempest/api/object_storage/test_object_temp_url.py
@@ -25,6 +25,7 @@
class ObjectTempUrlTest(base.BaseObjectTest):
+ """Test object temp url"""
@classmethod
def resource_setup(cls):
@@ -90,6 +91,7 @@
@decorators.idempotent_id('f91c96d4-1230-4bba-8eb9-84476d18d991')
@utils.requires_ext(extension='tempurl', service='object')
def test_get_object_using_temp_url(self):
+ """Test getting object using temp url"""
expires = self._get_expiry_date()
# get a temp URL for the created object
@@ -109,6 +111,7 @@
@decorators.idempotent_id('671f9583-86bd-4128-a034-be282a68c5d8')
@utils.requires_ext(extension='tempurl', service='object')
def test_get_object_using_temp_url_key_2(self):
+ """Test getting object using metadata 'Temp-URL-Key-2'"""
key2 = 'Meta2-'
metadata = {'Temp-URL-Key-2': key2}
self.account_client.create_update_or_delete_account_metadata(
@@ -134,6 +137,7 @@
@decorators.idempotent_id('9b08dade-3571-4152-8a4f-a4f2a873a735')
@utils.requires_ext(extension='tempurl', service='object')
def test_put_object_using_temp_url(self):
+ """Test putting object using temp url"""
new_data = data_utils.random_bytes(size=len(self.object_name))
expires = self._get_expiry_date()
@@ -160,6 +164,7 @@
@decorators.idempotent_id('249a0111-5ad3-4534-86a7-1993d55f9185')
@utils.requires_ext(extension='tempurl', service='object')
def test_head_object_using_temp_url(self):
+ """Test HEAD operation of object using temp url"""
expires = self._get_expiry_date()
# get a temp URL for the created object
@@ -174,6 +179,7 @@
@decorators.idempotent_id('9d9cfd90-708b-465d-802c-e4a8090b823d')
@utils.requires_ext(extension='tempurl', service='object')
def test_get_object_using_temp_url_with_inline_query_parameter(self):
+ """Test getting object using temp url with inline query parameter"""
expires = self._get_expiry_date()
# get a temp URL for the created object
diff --git a/tempest/api/object_storage/test_object_temp_url_negative.py b/tempest/api/object_storage/test_object_temp_url_negative.py
index 17ae6c1..bbb4827 100644
--- a/tempest/api/object_storage/test_object_temp_url_negative.py
+++ b/tempest/api/object_storage/test_object_temp_url_negative.py
@@ -26,6 +26,7 @@
class ObjectTempUrlNegativeTest(base.BaseObjectTest):
+ """Negative tests of object temp url"""
metadata = {}
containers = []
@@ -96,7 +97,7 @@
@decorators.idempotent_id('5a583aca-c804-41ba-9d9a-e7be132bdf0b')
@utils.requires_ext(extension='tempurl', service='object')
def test_get_object_after_expiration_time(self):
-
+ """Test getting object after expiration time"""
expires = self._get_expiry_date(1)
# get a temp URL for the created object
url = self._get_temp_url(self.container_name,
diff --git a/tempest/api/object_storage/test_object_version.py b/tempest/api/object_storage/test_object_version.py
index 75111b6..b64b172 100644
--- a/tempest/api/object_storage/test_object_version.py
+++ b/tempest/api/object_storage/test_object_version.py
@@ -24,6 +24,8 @@
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 @@
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)
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index b073604..5ab8e87 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -22,6 +22,8 @@
class VolumeQuotasAdminTestJSON(base.BaseVolumeAdminTest):
+ """Test volume quotas with admin privilege"""
+
credentials = ['primary', 'alt', 'admin']
def setUp(self):
@@ -54,17 +56,19 @@
@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 @@
@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 @@
@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 @@
@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,
diff --git a/tempest/api/volume/admin/test_volume_retype.py b/tempest/api/volume/admin/test_volume_retype.py
index 18e0b9b..5c14d52 100644
--- a/tempest/api/volume/admin/test_volume_retype.py
+++ b/tempest/api/volume/admin/test_volume_retype.py
@@ -88,6 +88,7 @@
class VolumeRetypeWithMigrationTest(VolumeRetypeTest):
+ """Test volume retype with migration"""
@classmethod
def skip_checks(cls):
@@ -134,11 +135,25 @@
@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 VolumeRetypeWithoutMigrationTest(VolumeRetypeTest):
+ """Test volume retype without migration"""
@classmethod
def resource_setup(cls):
@@ -174,6 +190,13 @@
@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
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 293af81..1d12a73 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -39,12 +39,14 @@
@decorators.idempotent_id('e0218299-0a59-4f43-8b2b-f1c035b3d26d')
def test_list_services(self):
+ """Test listing volume services"""
services = (self.admin_volume_services_client.list_services()
['services'])
self.assertNotEmpty(services)
@decorators.idempotent_id('63a3e1ca-37ee-4983-826d-83276a370d25')
def test_get_service_by_service_binary_name(self):
+ """Test getting volume service by binary name"""
services = (self.admin_volume_services_client.list_services(
binary=self.binary_name)['services'])
self.assertNotEmpty(services)
@@ -53,6 +55,7 @@
@decorators.idempotent_id('178710e4-7596-4e08-9333-745cb8bc4f8d')
def test_get_service_by_host_name(self):
+ """Test getting volume service by service host name"""
services_on_host = [service for service in self.services if
_get_host(service['host']) == self.host_name]
@@ -69,6 +72,7 @@
@decorators.idempotent_id('67ec6902-f91d-4dec-91fa-338523208bbc')
def test_get_service_by_volume_host_name(self):
+ """Test getting volume service by volume host name"""
volume_id = self.create_volume()['id']
volume = self.admin_volume_client.show_volume(volume_id)['volume']
hostname = _get_host(volume['os-vol-host-attr:host'])
@@ -83,7 +87,7 @@
@decorators.idempotent_id('ffa6167c-4497-4944-a464-226bbdb53908')
def test_get_service_by_service_and_host_name(self):
-
+ """Test getting volume service by binary name and host name"""
services = (self.admin_volume_services_client.list_services(
host=self.host_name, binary=self.binary_name))['services']
diff --git a/tempest/api/volume/admin/test_volume_services_negative.py b/tempest/api/volume/admin/test_volume_services_negative.py
index 3a863a1..bf39be5 100644
--- a/tempest/api/volume/admin/test_volume_services_negative.py
+++ b/tempest/api/volume/admin/test_volume_services_negative.py
@@ -19,6 +19,7 @@
class VolumeServicesNegativeTest(base.BaseVolumeAdminTest):
+ """Negative tests of volume services"""
@classmethod
def resource_setup(cls):
@@ -30,6 +31,7 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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')
diff --git a/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py b/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py
index ff5e7e2..10fd485 100644
--- a/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py
+++ b/tempest/api/volume/admin/test_volume_snapshot_quotas_negative.py
@@ -24,6 +24,7 @@
class VolumeSnapshotQuotasNegativeTestJSON(base.BaseVolumeAdminTest):
+ """Negative tests of volume snapshot quotas"""
@classmethod
def skip_checks(cls):
@@ -67,6 +68,7 @@
@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 @@
@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)
diff --git a/tempest/api/volume/admin/test_volume_type_access.py b/tempest/api/volume/admin/test_volume_type_access.py
index b64face..55ec428 100644
--- a/tempest/api/volume/admin/test_volume_type_access.py
+++ b/tempest/api/volume/admin/test_volume_type_access.py
@@ -24,11 +24,13 @@
class VolumeTypesAccessTest(base.BaseVolumeAdminTest):
+ """Test volume type access"""
credentials = ['primary', 'alt', 'admin']
@decorators.idempotent_id('d4dd0027-835f-4554-a6e5-50903fb79184')
def test_volume_type_access_add(self):
+ """Test adding volume type access for non-admin project"""
# Creating a NON public volume type
params = {'os-volume-type-access:is_public': False}
volume_type = self.create_volume_type(**params)
@@ -52,6 +54,7 @@
@decorators.idempotent_id('5220eb28-a435-43ce-baaf-ed46f0e95159')
def test_volume_type_access_list(self):
+ """Test listing volume type access"""
# Creating a NON public volume type
params = {'os-volume-type-access:is_public': False}
volume_type = self.create_volume_type(**params)
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index 730acdf..852aa93 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -19,6 +19,7 @@
class VolumeTypesExtraSpecsTest(base.BaseVolumeAdminTest):
+ """Test volume type extra specs"""
@classmethod
def resource_setup(cls):
@@ -27,7 +28,7 @@
@decorators.idempotent_id('b42923e9-0452-4945-be5b-d362ae533e60')
def test_volume_type_extra_specs_list(self):
- # List Volume types extra specs.
+ """Test listing volume type extra specs"""
extra_specs = {"spec1": "val1"}
body = self.admin_volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)['extra_specs']
@@ -40,7 +41,7 @@
@decorators.idempotent_id('0806db36-b4a0-47a1-b6f3-c2e7f194d017')
def test_volume_type_extra_specs_update(self):
- # Update volume type extra specs
+ """Test updating volume type extra specs"""
extra_specs = {"spec2": "val1"}
body = self.admin_volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'], extra_specs)['extra_specs']
@@ -74,7 +75,7 @@
@decorators.idempotent_id('d4772798-601f-408a-b2a5-29e8a59d1220')
def test_volume_type_extra_spec_create_get_delete(self):
- # Create/Get/Delete volume type extra spec.
+ """Test Create/Get/Delete volume type extra specs"""
spec_key = "spec3"
extra_specs = {spec_key: "val1"}
body = self.admin_volume_types_client.create_volume_type_extra_specs(
diff --git a/tempest/api/volume/admin/test_volumes_backup.py b/tempest/api/volume/admin/test_volumes_backup.py
index 45060d0..bd4b3fa 100644
--- a/tempest/api/volume/admin/test_volumes_backup.py
+++ b/tempest/api/volume/admin/test_volumes_backup.py
@@ -67,11 +67,8 @@
# Export Backup
export_backup = (self.admin_backups_client.export_backup(backup['id'])
['backup-record'])
- self.assertIn('backup_service', export_backup)
- self.assertIn('backup_url', export_backup)
self.assertTrue(export_backup['backup_service'].startswith(
'cinder.backup.drivers'))
- self.assertIsNotNone(export_backup['backup_url'])
# NOTE(geguileo): Backups are imported with the same backup id
# (important for incremental backups among other things), so we cannot
@@ -92,7 +89,6 @@
# deletions will delete data from the backup back-end because they
# were both pointing to the same backend data.
self.addCleanup(self._delete_backup, new_id)
- self.assertIn("id", import_backup)
self.assertEqual(new_id, import_backup['id'])
waiters.wait_for_volume_resource_status(self.admin_backups_client,
import_backup['id'],
diff --git a/tempest/api/volume/admin/test_volumes_list.py b/tempest/api/volume/admin/test_volumes_list.py
index 6ce4a85..c3229f0 100644
--- a/tempest/api/volume/admin/test_volumes_list.py
+++ b/tempest/api/volume/admin/test_volumes_list.py
@@ -24,6 +24,7 @@
class VolumesListAdminTestJSON(base.BaseVolumeAdminTest):
+ """Test listing volumes with admin privilege"""
@classmethod
def resource_setup(cls):
@@ -41,7 +42,7 @@
@decorators.idempotent_id('5866286f-3290-4cfd-a414-088aa6cdc469')
def test_volume_list_param_tenant(self):
- # Test to list volumes from single tenant
+ """Test admin can list volumes belonging to specified project"""
# Create a volume in admin tenant
adm_vol = self.admin_volume_client.create_volume(
size=CONF.volume.volume_size)['volume']
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index 0b6ee38..39369be 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -22,7 +22,7 @@
@decorators.idempotent_id('01f1ae88-eba9-4c6b-a011-6f7ace06b725')
def test_get_availability_zone_list(self):
- # List of availability zone
+ """Test listing volume available zones"""
availability_zone = (
self.availability_zone_client.list_availability_zones()
['availabilityZoneInfo'])
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index 39ce00c..acd9ca2 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -26,10 +26,11 @@
class ExtensionsTestJSON(base.BaseVolumeTest):
+ """Test volume extensions"""
@decorators.idempotent_id('94607eb0-43a5-47ca-82aa-736b41bd2e2c')
def test_list_extensions(self):
- # List of all extensions
+ """Test listing volume extensions"""
extensions = (self.volumes_extension_client.list_extensions()
['extensions'])
if not CONF.volume_feature_enabled.api_extensions:
diff --git a/tempest/api/volume/test_image_metadata.py b/tempest/api/volume/test_image_metadata.py
index 53b3acc..8f9bbd2 100644
--- a/tempest/api/volume/test_image_metadata.py
+++ b/tempest/api/volume/test_image_metadata.py
@@ -24,6 +24,7 @@
class VolumesImageMetadata(base.BaseVolumeTest):
+ """Test volume image metadata"""
@classmethod
def skip_checks(cls):
@@ -41,6 +42,7 @@
@decorators.idempotent_id('03efff0b-5c75-4822-8f10-8789ac15b13e')
@utils.services('image')
def test_update_show_delete_image_metadata(self):
+ """Test update/show/delete volume's image metadata"""
# Update image metadata
image_metadata = {'image_id': '5137a025-3c5f-43c1-bc64-5f41270040a5',
'image_name': 'image',
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index e6fe25d..ee1b5e5 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -23,6 +23,8 @@
class SnapshotMetadataTestJSON(base.BaseVolumeTest):
+ """Test snapshot metadata"""
+
@classmethod
def skip_checks(cls):
super(SnapshotMetadataTestJSON, cls).skip_checks()
@@ -45,6 +47,7 @@
@decorators.idempotent_id('a2f20f99-e363-4584-be97-bc33afb1a56c')
def test_crud_snapshot_metadata(self):
+ """Test create/get/update/delete snapshot metadata"""
# Create metadata for the snapshot
metadata = {"key1": "value1",
"key2": "value2",
@@ -82,7 +85,7 @@
@decorators.idempotent_id('e8ff85c5-8f97-477f-806a-3ac364a949ed')
def test_update_show_snapshot_metadata_item(self):
- # Update metadata item for the snapshot
+ """Test update/show snapshot metadata item"""
metadata = {"key1": "value1",
"key2": "value2",
"key3": "value3"}
diff --git a/tempest/api/volume/test_versions.py b/tempest/api/volume/test_versions.py
index 1e5c9de..e065bdf 100644
--- a/tempest/api/volume/test_versions.py
+++ b/tempest/api/volume/test_versions.py
@@ -17,14 +17,14 @@
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 @@
@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.
diff --git a/tempest/api/volume/test_volume_absolute_limits.py b/tempest/api/volume/test_volume_absolute_limits.py
index 4d64a95..ccf0804 100644
--- a/tempest/api/volume/test_volume_absolute_limits.py
+++ b/tempest/api/volume/test_volume_absolute_limits.py
@@ -24,6 +24,7 @@
# 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 @@
@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']
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index e42ea40..5b50bfa 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -25,6 +25,8 @@
class VolumesActionsTest(base.BaseVolumeTest):
+ """Test volume actions"""
+
create_default_network = True
@classmethod
@@ -38,6 +40,7 @@
@decorators.attr(type='smoke')
@utils.services('compute')
def test_attach_detach_volume_to_instance(self):
+ """Test attaching and detaching volume to instance"""
# Create a server
server = self.create_server()
# Volume is attached and detached successfully from an instance
@@ -53,7 +56,7 @@
@decorators.idempotent_id('63e21b4c-0a0c-41f6-bfc3-7c2816815599')
def test_volume_bootable(self):
- # Verify that a volume bootable flag is retrieved
+ """Test setting and retrieving bootable flag of a volume"""
for bool_bootable in [True, False]:
self.volumes_client.set_bootable_volume(self.volume['id'],
bootable=bool_bootable)
@@ -69,6 +72,11 @@
@decorators.idempotent_id('9516a2c8-9135-488c-8dd6-5677a7e5f371')
@utils.services('compute')
def test_get_volume_attachment(self):
+ """Test getting volume attachments
+
+ Attach a volume to a server, and then retrieve volume's attachments
+ info.
+ """
# Create a server
server = self.create_server()
# Verify that a volume's attachment information is retrieved
@@ -96,6 +104,7 @@
@decorators.idempotent_id('d8f1ca95-3d5b-44a3-b8ca-909691c9532d')
@utils.services('image')
def test_volume_upload(self):
+ """Test uploading volume to create an image"""
# NOTE(gfidente): the volume uploaded in Glance comes from setUpClass,
# it is shared with the other tests. After it is uploaded in Glance,
# there is no way to delete it from Cinder, so we delete it from Glance
@@ -118,6 +127,7 @@
@decorators.idempotent_id('92c4ef64-51b2-40c0-9f7e-4749fbaaba33')
def test_reserve_unreserve_volume(self):
+ """Test reserving and unreserving volume"""
# Mark volume as reserved.
self.volumes_client.reserve_volume(self.volume['id'])
# To get the volume info
@@ -131,6 +141,7 @@
@decorators.idempotent_id('fff74e1e-5bd3-4b33-9ea9-24c103bc3f59')
def test_volume_readonly_update(self):
+ """Test updating and retrieve volume's readonly flag"""
for readonly in [True, False]:
# Update volume readonly
self.volumes_client.update_volume_readonly(self.volume['id'],
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index c178272..2e78114 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -27,6 +27,7 @@
class VolumesBackupsTest(base.BaseVolumeTest):
+ """Test volumes backup"""
@classmethod
def skip_checks(cls):
@@ -54,6 +55,16 @@
'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",
@@ -80,11 +91,7 @@
self.assertEqual('container', backup['container'])
# Get all backups with detail
- backups = self.backups_client.list_backups(
- detail=True)['backups']
- for backup_info in backups:
- self.assertIn('created_at', backup_info)
- self.assertIn('links', backup_info)
+ backups = self.backups_client.list_backups(detail=True)['backups']
self.assertIn((backup['name'], backup['id']),
[(m['name'], m['id']) for m in backups])
@@ -93,7 +100,7 @@
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()))
@@ -124,6 +131,13 @@
@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)
@@ -148,6 +162,7 @@
class VolumesBackupsV39Test(base.BaseVolumeTest):
+ """Test volumes backup with volume microversion greater than 3.8"""
_api_version = 3
min_microversion = '3.9'
@@ -161,6 +176,7 @@
@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'])
@@ -176,7 +192,6 @@
backup['id'], **update_kwargs)['backup']
self.assertEqual(backup['id'], update_backup['id'])
self.assertEqual(update_kwargs['name'], update_backup['name'])
- self.assertIn('links', update_backup)
# Assert response body for show_backup method
retrieved_backup = self.backups_client.show_backup(
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 866bd87..76c22f0 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -28,6 +28,7 @@
class VolumesNegativeTest(base.BaseVolumeTest):
+ """Negative tests of volumes"""
@classmethod
def resource_setup(cls):
@@ -58,50 +59,49 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f131c586-9448-44a4-a8b0-54ca838aa43e')
def test_volume_get_nonexistent_volume_id(self):
- # Should not be able to get a non-existent volume
+ """Test getting non existent volume should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.show_volume,
data_utils.rand_uuid())
@decorators.attr(type=['negative'])
@decorators.idempotent_id('555efa6e-efcd-44ef-8a3b-4a7ca4837a29')
def test_volume_delete_nonexistent_volume_id(self):
- # Should not be able to delete a non-existent Volume
+ """Test deleting non existent volume should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.delete_volume,
data_utils.rand_uuid())
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1ed83a8a-682d-4dfb-a30e-ee63ffd6c049')
def test_create_volume_with_invalid_size(self):
- # Should not be able to create volume with invalid size in request
+ """Test creating volume with invalid size should fail"""
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume, size='#$%')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9387686f-334f-4d31-a439-33494b9e2683')
def test_create_volume_without_passing_size(self):
- # Should not be able to create volume without passing size
- # in request
+ """Test creating volume with empty size should fail"""
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume, size='')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('41331caa-eaf4-4001-869d-bc18c1869360')
def test_create_volume_with_size_zero(self):
- # Should not be able to create volume with size zero
+ """Test creating volume with zero size should fail"""
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume, size='0')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8b472729-9eba-446e-a83b-916bdb34bef7')
def test_create_volume_with_size_negative(self):
- # Should not be able to create volume with size negative
+ """Test creating volume with negative size should fail"""
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.create_volume, size='-1')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('10254ed8-3849-454e-862e-3ab8e6aa01d2')
def test_create_volume_with_nonexistent_volume_type(self):
- # Should not be able to create volume with non-existent volume type
+ """Test creating volume with non existent volume type should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size=CONF.volume.volume_size,
volume_type=data_utils.rand_uuid())
@@ -109,7 +109,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0c36f6ae-4604-4017-b0a9-34fdc63096f9')
def test_create_volume_with_nonexistent_snapshot_id(self):
- # Should not be able to create volume with non-existent snapshot
+ """Test creating volume with non existent snapshot should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size=CONF.volume.volume_size,
snapshot_id=data_utils.rand_uuid())
@@ -117,7 +117,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('47c73e08-4be8-45bb-bfdf-0c4e79b88344')
def test_create_volume_with_nonexistent_source_volid(self):
- # Should not be able to create volume with non-existent source volume
+ """Test creating volume with non existent source volume should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.create_volume,
size=CONF.volume.volume_size,
source_volid=data_utils.rand_uuid())
@@ -125,46 +125,49 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0186422c-999a-480e-a026-6a665744c30c')
def test_update_volume_with_nonexistent_volume_id(self):
+ """Test updating non existent volume should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
volume_id=data_utils.rand_uuid())
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e66e40d6-65e6-4e75-bdc7-636792fa152d')
def test_update_volume_with_invalid_volume_id(self):
+ """Test updating volume with invalid volume id should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
volume_id=data_utils.rand_name('invalid'))
@decorators.attr(type=['negative'])
@decorators.idempotent_id('72aeca85-57a5-4c1f-9057-f320f9ea575b')
def test_update_volume_with_empty_volume_id(self):
+ """Test updating volume with empty volume id should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.update_volume,
volume_id='')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('30799cfd-7ee4-446c-b66c-45b383ed211b')
def test_get_invalid_volume_id(self):
- # Should not be able to get volume with invalid id
+ """Test getting volume with invalid volume id should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.show_volume,
data_utils.rand_name('invalid'))
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c6c3db06-29ad-4e91-beb0-2ab195fe49e3')
def test_get_volume_without_passing_volume_id(self):
- # Should not be able to get volume when empty ID is passed
+ """Test getting volume with empty volume id should fail"""
self.assertRaises(lib_exc.NotFound,
self.volumes_client.show_volume, '')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1f035827-7c32-4019-9240-b4ec2dbd9dfd')
def test_delete_invalid_volume_id(self):
- # Should not be able to delete volume when invalid ID is passed
+ """Test deleting volume with invalid volume id should fail"""
self.assertRaises(lib_exc.NotFound, self.volumes_client.delete_volume,
data_utils.rand_name('invalid'))
@decorators.attr(type=['negative'])
@decorators.idempotent_id('441a1550-5d44-4b30-af0f-a6d402f52026')
def test_delete_volume_without_passing_volume_id(self):
- # Should not be able to delete volume when empty ID is passed
+ """Test deleting volume with empty volume id should fail"""
self.assertRaises(lib_exc.NotFound,
self.volumes_client.delete_volume, '')
@@ -172,6 +175,7 @@
@decorators.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6')
@utils.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
+ """Test attaching non existent volume to server should fail"""
server = self.create_server()
self.assertRaises(lib_exc.NotFound,
@@ -183,6 +187,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9f9c24e4-011d-46b5-b992-952140ce237a')
def test_detach_volumes_with_invalid_volume_id(self):
+ """Test detaching volume with invalid volume id should fail"""
self.assertRaises(lib_exc.NotFound,
self.volumes_client.detach_volume,
'xxx')
@@ -190,7 +195,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e0c75c74-ee34-41a9-9288-2a2051452854')
def test_volume_extend_with_size_smaller_than_original_size(self):
- # Extend volume with smaller size than original size.
+ """Test extending volume with decreasing size should fail"""
extend_size = 0
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.extend_volume,
@@ -199,7 +204,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5d0b480d-e833-439f-8a5a-96ad2ed6f22f')
def test_volume_extend_with_non_number_size(self):
- # Extend volume when size is non number.
+ """Test extending volume with non-integer size should fail"""
extend_size = 'abc'
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.extend_volume,
@@ -208,7 +213,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('355218f1-8991-400a-a6bb-971239287d92')
def test_volume_extend_with_None_size(self):
- # Extend volume with None size.
+ """Test extending volume with none size should fail"""
extend_size = None
self.assertRaises(lib_exc.BadRequest,
self.volumes_client.extend_volume,
@@ -217,7 +222,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('8f05a943-013c-4063-ac71-7baf561e82eb')
def test_volume_extend_with_nonexistent_volume_id(self):
- # Extend volume size when volume is nonexistent.
+ """Test extending non existent volume should fail"""
extend_size = self.volume['size'] + 1
self.assertRaises(lib_exc.NotFound, self.volumes_client.extend_volume,
data_utils.rand_uuid(), new_size=extend_size)
@@ -225,7 +230,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('aff8ba64-6d6f-4f2e-bc33-41a08ee9f115')
def test_volume_extend_without_passing_volume_id(self):
- # Extend volume size when passing volume id is None.
+ """Test extending volume without passing volume id should fail"""
extend_size = self.volume['size'] + 1
self.assertRaises(lib_exc.NotFound, self.volumes_client.extend_volume,
None, new_size=extend_size)
@@ -233,6 +238,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ac6084c0-0546-45f9-b284-38a367e0e0e2')
def test_reserve_volume_with_nonexistent_volume_id(self):
+ """Test reserving non existent volume should fail"""
self.assertRaises(lib_exc.NotFound,
self.volumes_client.reserve_volume,
data_utils.rand_uuid())
@@ -240,6 +246,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('eb467654-3dc1-4a72-9b46-47c29d22654c')
def test_unreserve_volume_with_nonexistent_volume_id(self):
+ """Test unreserving non existent volume should fail"""
self.assertRaises(lib_exc.NotFound,
self.volumes_client.unreserve_volume,
data_utils.rand_uuid())
@@ -247,6 +254,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('449c4ed2-ecdd-47bb-98dc-072aeccf158c')
def test_reserve_volume_with_negative_volume_status(self):
+ """Test reserving already reserved volume should fail"""
# Mark volume as reserved.
self.volumes_client.reserve_volume(self.volume['id'])
# Mark volume which is marked as reserved before
@@ -259,6 +267,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0f4aa809-8c7b-418f-8fb3-84c7a5dfc52f')
def test_list_volumes_with_nonexistent_name(self):
+ """Test listing volumes with non existent name should get nothing"""
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
params = {'name': v_name}
fetched_volume = self.volumes_client.list_volumes(
@@ -268,6 +277,10 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9ca17820-a0e7-4cbd-a7fa-f4468735e359')
def test_list_volumes_detail_with_nonexistent_name(self):
+ """Test listing volume details with non existent name
+
+ Listing volume details with non existent name should get nothing.
+ """
v_name = data_utils.rand_name(self.__class__.__name__ + '-Volume')
params = {'name': v_name}
fetched_volume = \
@@ -278,6 +291,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('143b279b-7522-466b-81be-34a87d564a7c')
def test_list_volumes_with_invalid_status(self):
+ """Test listing volumes with invalid status should get nothing"""
params = {'status': 'null'}
fetched_volume = self.volumes_client.list_volumes(
params=params)['volumes']
@@ -286,6 +300,10 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ba94b27b-be3f-496c-a00e-0283b373fa75')
def test_list_volumes_detail_with_invalid_status(self):
+ """Test listing volume details with invalid status
+
+ Listing volume details with invalid status should get nothing
+ """
params = {'status': 'null'}
fetched_volume = \
self.volumes_client.list_volumes(detail=True,
@@ -296,6 +314,7 @@
@decorators.idempotent_id('5b810c91-0ad1-47ce-aee8-615f789be78f')
@utils.services('image')
def test_create_volume_from_image_with_decreasing_size(self):
+ """Test creating volume from image with decreasing size should fail"""
# Create image
image = self.create_image()
@@ -311,6 +330,7 @@
@decorators.idempotent_id('d15e7f35-2cfc-48c8-9418-c8223a89bcbb')
@utils.services('image')
def test_create_volume_from_deactivated_image(self):
+ """Test creating volume from deactivated image should fail"""
# Create image
image = self.create_image()
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index bf221e8..fd2e7c4 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -25,6 +25,8 @@
class VolumesSnapshotTestJSON(base.BaseVolumeTest):
+ """Test volume snapshots"""
+
create_default_network = True
@classmethod
@@ -41,6 +43,7 @@
@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 @@
@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 @@
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 @@
@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 @@
@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'])
diff --git a/tempest/api/volume/test_volumes_snapshots_list.py b/tempest/api/volume/test_volumes_snapshots_list.py
index f4f039c..77627bc 100644
--- a/tempest/api/volume/test_volumes_snapshots_list.py
+++ b/tempest/api/volume/test_volumes_snapshots_list.py
@@ -18,6 +18,7 @@
class VolumesSnapshotListTestJSON(base.BaseVolumeTest):
+ """Test listing volume snapshots"""
@classmethod
def skip_checks(cls):
@@ -50,6 +51,7 @@
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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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
diff --git a/tempest/api/volume/test_volumes_snapshots_negative.py b/tempest/api/volume/test_volumes_snapshots_negative.py
index 0453c0a..9c36dc6 100644
--- a/tempest/api/volume/test_volumes_snapshots_negative.py
+++ b/tempest/api/volume/test_volumes_snapshots_negative.py
@@ -20,6 +20,7 @@
class VolumesSnapshotNegativeTestJSON(base.BaseVolumeTest):
+ """Negative tests of volume snapshot"""
@classmethod
def skip_checks(cls):
@@ -30,7 +31,7 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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 @@
@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())
diff --git a/tempest/config.py b/tempest/config.py
index eca2023..989b8ef 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -481,6 +481,12 @@
'MIN_LIBVIRT_VERSION is >= 1.2.17 on all '
'branches from stable/rocky and will be '
'removed in a future release.'),
+ cfg.BoolOpt('can_migrate_between_any_hosts',
+ default=True,
+ help="Does the test environment support migrating between "
+ "any hosts? In environments with non-homogeneous compute "
+ "nodes you can set this to False so that it will select "
+ "destination host for migrating automatically"),
cfg.BoolOpt('vnc_console',
default=False,
help='Enable VNC console. This configuration value should '
diff --git a/tempest/lib/api_schema/response/volume/backups.py b/tempest/lib/api_schema/response/volume/backups.py
new file mode 100644
index 0000000..9e85f5f
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/backups.py
@@ -0,0 +1,229 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+
+common_show_backup = {
+ 'type': 'object',
+ 'properties': {
+ 'status': {'type': 'string'},
+ 'object_count': {'type': 'integer'},
+ 'container': {'type': ['string', 'null']},
+ 'description': {'type': ['string', 'null']},
+ 'links': parameter_types.links,
+ 'availability_zone': {'type': ['string', 'null']},
+ 'created_at': parameter_types.date_time,
+ 'updated_at': parameter_types.date_time_or_null,
+ 'name': {'type': ['string', 'null']},
+ 'has_dependent_backups': {'type': 'boolean'},
+ 'volume_id': {'type': 'string', 'format': 'uuid'},
+ 'fail_reason': {'type': ['string', 'null']},
+ 'size': {'type': 'integer'},
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'is_incremental': {'type': 'boolean'},
+ 'data_timestamp': parameter_types.date_time_or_null,
+ 'snapshot_id': {'type': ['string', 'null']},
+ # TODO(zhufl): os-backup-project-attr:project_id is added
+ # in 3.18, we should move it to the 3.18 schema file when
+ # microversion is supported in volume interfaces.
+ 'os-backup-project-attr:project_id': {
+ 'type': 'string', 'format': 'uuid'},
+ # TODO(zhufl): metadata is added in 3.43, we should move it
+ # to the 3.43 schema file when microversion is supported
+ # in volume interfaces.
+ 'metadata': {'^.+$': {'type': 'string'}},
+ # TODO(zhufl): user_id is added in 3.56, we should move it
+ # to the 3.56 schema file when microversion is supported
+ # in volume interfaces.
+ 'user_id': {'type': 'string'},
+ },
+ 'additionalProperties': False,
+ 'required': ['status', 'object_count', 'fail_reason', 'links',
+ 'created_at', 'updated_at', 'name', 'volume_id', 'size', 'id',
+ 'data_timestamp']
+}
+
+create_backup = {
+ 'status_code': [202],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backup': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'links': parameter_types.links,
+ 'name': {'type': 'string'},
+ # TODO(zhufl): metadata is added in 3.43, we should move it
+ # to the 3.43 schema file when microversion is supported
+ # in volume interfaces.
+ 'metadata': {'^.+$': {'type': 'string'}},
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'links', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backup']
+ }
+}
+
+update_backup = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backup': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'links': parameter_types.links,
+ 'name': {'type': 'string'},
+ 'metadata': {'^.+$': {'type': 'string'}}
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'links', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backup']
+ }
+}
+
+restore_backup = {
+ 'status_code': [202],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'restore': {
+ 'type': 'object',
+ 'properties': {
+ 'backup_id': {'type': 'string', 'format': 'uuid'},
+ 'volume_id': {'type': 'string', 'format': 'uuid'},
+ 'volume_name': {'type': 'string'},
+ },
+ 'additionalProperties': False,
+ 'required': ['backup_id', 'volume_id', 'volume_name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['restore']
+ }
+}
+
+delete_backup = {'status_code': [202]}
+
+show_backup = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backup': common_show_backup
+ },
+ 'additionalProperties': False,
+ 'required': ['backup']
+ }
+}
+
+list_backups_no_detail = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backups': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'links': parameter_types.links,
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': ['string', 'null']},
+ # TODO(zhufl): count is added in 3.45, we should move
+ # it to the 3.45 schema file when microversion is
+ # supported in volume interfaces
+ 'count': {'type': 'integer'}
+ },
+ 'additionalProperties': False,
+ 'required': ['links', 'id', 'name']
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backups'],
+ }
+}
+
+list_backups_detail = copy.deepcopy(common_show_backup)
+# TODO(zhufl): count is added in 3.45, we should move it to the 3.45 schema
+# file when microversion is supported in volume interfaces
+list_backups_detail['properties'].update({'count': {'type': 'integer'}})
+list_backups_with_detail = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backups': {
+ 'type': 'array',
+ 'items': list_backups_detail
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backups'],
+ }
+}
+
+export_backup = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backup-record': {
+ 'type': 'object',
+ 'properties': {
+ 'backup_service': {'type': 'string'},
+ 'backup_url': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'required': ['backup_service', 'backup_url']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backup-record']
+ }
+}
+
+import_backup = {
+ 'status_code': [201],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'backup': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'links': parameter_types.links,
+ 'name': {'type': ['string', 'null']},
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'links', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['backup']
+ }
+}
+
+reset_backup_status = {'status_code': [202]}
diff --git a/tempest/lib/api_schema/response/volume/groups.py b/tempest/lib/api_schema/response/volume/groups.py
new file mode 100644
index 0000000..cb31269
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/groups.py
@@ -0,0 +1,164 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+
+create_group = {
+ 'status_code': [202],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'group': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'},
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['group']
+ }
+}
+
+delete_group = {'status_code': [202]}
+
+show_group = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'group': {
+ 'type': 'object',
+ 'properties': {
+ 'status': {'type': 'string'},
+ 'description': {'type': ['string', 'null']},
+ 'availability_zone': {'type': 'string'},
+ 'created_at': parameter_types.date_time,
+ 'group_type': {'type': 'string', 'format': 'uuid'},
+ 'group_snapshot_id': {'type': ['string', 'null']},
+ 'source_group_id': {'type': ['string', 'null']},
+ 'volume_types': {
+ 'type': 'array',
+ 'items': {'type': 'string', 'format': 'uuid'}
+ },
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'},
+ # TODO(zhufl): volumes is added in 3.25, we should move it
+ # to the 3.25 schema file when microversion is supported
+ # in volume interfaces
+ 'volumes': {
+ 'type': 'array',
+ 'items': {'type': 'string', 'format': 'uuid'}
+ },
+ 'replication_status': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'required': ['status', 'description', 'created_at',
+ 'group_type', 'volume_types', 'id', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['group']
+ }
+}
+
+list_groups_no_detail = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'groups': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'}
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'name'],
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['groups'],
+ }
+}
+
+list_groups_with_detail = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'groups': {
+ 'type': 'array',
+ 'items': {
+ 'type': 'object',
+ 'properties': {
+ 'status': {'type': 'string'},
+ 'description': {'type': ['string', 'null']},
+ 'availability_zone': {'type': 'string'},
+ 'created_at': parameter_types.date_time,
+ 'group_type': {'type': 'string', 'format': 'uuid'},
+ 'group_snapshot_id': {'type': ['string', 'null']},
+ 'source_group_id': {'type': ['string', 'null']},
+ 'volume_types': {
+ 'type': 'array',
+ 'items': {'type': 'string', 'format': 'uuid'}
+ },
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'},
+ # TODO(zhufl): volumes is added in 3.25, we should
+ # move it to the 3.25 schema file when microversion
+ # is supported in volume interfaces
+ 'volumes': {
+ 'type': 'array',
+ 'items': {'type': 'string', 'format': 'uuid'}
+ },
+ },
+ 'additionalProperties': False,
+ 'required': ['status', 'description', 'created_at',
+ 'group_type', 'volume_types', 'id', 'name']
+ }
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['groups'],
+ }
+}
+
+create_group_from_source = {
+ 'status_code': [202],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'group': {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string', 'format': 'uuid'},
+ 'name': {'type': 'string'},
+ },
+ 'additionalProperties': False,
+ 'required': ['id', 'name']
+ }
+ },
+ 'additionalProperties': False,
+ 'required': ['group']
+ }
+}
+update_group = {'status_code': [202]}
+reset_group_status = {'status_code': [202]}
diff --git a/tempest/lib/common/utils/linux/remote_client.py b/tempest/lib/common/utils/linux/remote_client.py
index 8ac1d38..71fed02 100644
--- a/tempest/lib/common/utils/linux/remote_client.py
+++ b/tempest/lib/common/utils/linux/remote_client.py
@@ -11,7 +11,6 @@
# under the License.
import functools
-import re
import sys
import netaddr
@@ -134,9 +133,8 @@
This method will not unmount the config drive, so unmount_config_drive
must be used for cleanup.
"""
- cmd_blkid = 'blkid | grep -i config-2'
- result = self.exec_command(cmd_blkid)
- dev_name = re.match('([^:]+)', result).group()
+ cmd_blkid = 'blkid -L config-2 -o device'
+ dev_name = self.exec_command(cmd_blkid).strip()
try:
self.exec_command('sudo mount %s /mnt' % dev_name)
diff --git a/tempest/lib/services/volume/v3/backups_client.py b/tempest/lib/services/volume/v3/backups_client.py
index 970471e..1df45fa 100644
--- a/tempest/lib/services/volume/v3/backups_client.py
+++ b/tempest/lib/services/volume/v3/backups_client.py
@@ -16,6 +16,7 @@
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
+from tempest.lib.api_schema.response.volume import backups as schema
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.volume import base_client
@@ -34,7 +35,7 @@
post_body = json.dumps({'backup': kwargs})
resp, body = self.post('backups', post_body)
body = json.loads(body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.create_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def update_backup(self, backup_id, **kwargs):
@@ -47,7 +48,7 @@
put_body = json.dumps({'backup': kwargs})
resp, body = self.put('backups/%s' % backup_id, put_body)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.update_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def restore_backup(self, backup_id, **kwargs):
@@ -60,13 +61,13 @@
post_body = json.dumps({'restore': kwargs})
resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
body = json.loads(body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.restore_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def delete_backup(self, backup_id):
"""Delete a backup of volume."""
resp, body = self.delete('backups/%s' % backup_id)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.delete_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def show_backup(self, backup_id):
@@ -74,7 +75,7 @@
url = "backups/%s" % backup_id
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.show_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def list_backups(self, detail=False, **params):
@@ -86,13 +87,15 @@
https://docs.openstack.org/api-ref/block-storage/v3/index.html#list-backups-with-detail
"""
url = "backups"
+ list_backups_schema = schema.list_backups_no_detail
if detail:
url += "/detail"
+ list_backups_schema = schema.list_backups_with_detail
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(list_backups_schema, resp, body)
return rest_client.ResponseBody(resp, body)
def export_backup(self, backup_id):
@@ -100,7 +103,7 @@
url = "backups/%s/export_record" % backup_id
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.export_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def import_backup(self, **kwargs):
@@ -113,14 +116,14 @@
post_body = json.dumps({'backup-record': kwargs})
resp, body = self.post("backups/import_record", post_body)
body = json.loads(body)
- self.expected_success(201, resp.status)
+ self.validate_response(schema.import_backup, resp, body)
return rest_client.ResponseBody(resp, body)
def reset_backup_status(self, backup_id, status):
"""Reset the specified backup's status."""
post_body = json.dumps({'os-reset_status': {"status": status}})
resp, body = self.post('backups/%s/action' % backup_id, post_body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.reset_backup_status, resp, body)
return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
diff --git a/tempest/lib/services/volume/v3/groups_client.py b/tempest/lib/services/volume/v3/groups_client.py
index ffae232..3d8523d 100644
--- a/tempest/lib/services/volume/v3/groups_client.py
+++ b/tempest/lib/services/volume/v3/groups_client.py
@@ -16,6 +16,7 @@
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
+from tempest.lib.api_schema.response.volume import groups as schema
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.volume import base_client
@@ -23,6 +24,7 @@
class GroupsClient(base_client.BaseClient):
"""Client class to send CRUD Volume Group API requests"""
+ api_version = 'v3'
def create_group(self, **kwargs):
"""Creates a group.
@@ -35,7 +37,7 @@
post_body = json.dumps({'group': kwargs})
resp, body = self.post('groups', post_body)
body = json.loads(body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.create_group, resp, body)
return rest_client.ResponseBody(resp, body)
def delete_group(self, group_id, delete_volumes=True):
@@ -49,7 +51,7 @@
post_body = json.dumps({'delete': post_body})
resp, body = self.post('groups/%s/action' % group_id,
post_body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.delete_group, resp, body)
return rest_client.ResponseBody(resp, body)
def show_group(self, group_id):
@@ -62,7 +64,7 @@
url = "groups/%s" % str(group_id)
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema.show_group, resp, body)
return rest_client.ResponseBody(resp, body)
def list_groups(self, detail=False, **params):
@@ -74,13 +76,15 @@
https://docs.openstack.org/api-ref/block-storage/v3/#list-groups-with-details
"""
url = "groups"
+ schema_list_groups = schema.list_groups_no_detail
if detail:
url += "/detail"
+ schema_list_groups = schema.list_groups_with_detail
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
- self.expected_success(200, resp.status)
+ self.validate_response(schema_list_groups, resp, body)
return rest_client.ResponseBody(resp, body)
def create_group_from_source(self, **kwargs):
@@ -93,7 +97,7 @@
post_body = json.dumps({'create-from-src': kwargs})
resp, body = self.post('groups/action', post_body)
body = json.loads(body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.create_group_from_source, resp, body)
return rest_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
@@ -105,7 +109,7 @@
"""
put_body = json.dumps({'group': kwargs})
resp, body = self.put('groups/%s' % group_id, put_body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.update_group, resp, body)
return rest_client.ResponseBody(resp, body)
def reset_group_status(self, group_id, status_to_set):
@@ -116,7 +120,7 @@
"""
post_body = json.dumps({'reset_status': {'status': status_to_set}})
resp, body = self.post('groups/%s/action' % group_id, post_body)
- self.expected_success(202, resp.status)
+ self.validate_response(schema.reset_group_status, resp, body)
return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
diff --git a/tempest/manager.py b/tempest/manager.py
index e3174d4..b485ef2 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -33,7 +33,7 @@
def __init__(self, credentials, scope='project'):
msg = ("tempest.manager.Manager is not a stable interface and as such "
- "it should not imported directly. It will be removed as "
+ "it should not be imported directly. It will be removed as "
"soon as the client manager becomes available in tempest.lib.")
LOG.warning(msg)
dscv = CONF.identity.disable_ssl_certificate_validation
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 5d51d15..ff860d5 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -91,10 +91,32 @@
volume_microversion=self.volume_request_microversion,
placement_microversion=self.placement_request_microversion))
+ def setup_compute_client(cls):
+ """Compute and Compute security groups client"""
+ cls.compute_images_client = cls.os_primary.compute_images_client
+ cls.keypairs_client = cls.os_primary.keypairs_client
+ cls.compute_security_groups_client = (
+ cls.os_primary.compute_security_groups_client)
+ cls.compute_security_group_rules_client = (
+ cls.os_primary.compute_security_group_rules_client)
+ cls.servers_client = cls.os_primary.servers_client
+ cls.interface_client = cls.os_primary.interfaces_client
+
+ def setup_network_client(cls):
+ """Neutron network client"""
+ cls.networks_client = cls.os_primary.networks_client
+ cls.ports_client = cls.os_primary.ports_client
+ cls.routers_client = cls.os_primary.routers_client
+ cls.subnets_client = cls.os_primary.subnets_client
+ cls.floating_ips_client = cls.os_primary.floating_ips_client
+ cls.security_groups_client = cls.os_primary.security_groups_client
+ cls.security_group_rules_client = (
+ cls.os_primary.security_group_rules_client)
+
@classmethod
def setup_clients(cls):
+ """This setup the service clients for the tests"""
super(ScenarioTest, cls).setup_clients()
- # Clients (in alphabetical order)
cls.flavors_client = cls.os_primary.flavors_client
cls.compute_floating_ips_client = (
cls.os_primary.compute_floating_ips_client)
@@ -108,37 +130,20 @@
raise lib_exc.InvalidConfiguration(
'Either api_v1 or api_v2 must be True in '
'[image-feature-enabled].')
- # Compute image client
- cls.compute_images_client = cls.os_primary.compute_images_client
- cls.keypairs_client = cls.os_primary.keypairs_client
- # Nova security groups client
- cls.compute_security_groups_client = (
- cls.os_primary.compute_security_groups_client)
- cls.compute_security_group_rules_client = (
- cls.os_primary.compute_security_group_rules_client)
- cls.servers_client = cls.os_primary.servers_client
- cls.interface_client = cls.os_primary.interfaces_client
- # Neutron network client
- cls.networks_client = cls.os_primary.networks_client
- cls.ports_client = cls.os_primary.ports_client
- cls.routers_client = cls.os_primary.routers_client
- cls.subnets_client = cls.os_primary.subnets_client
- cls.floating_ips_client = cls.os_primary.floating_ips_client
- cls.security_groups_client = cls.os_primary.security_groups_client
- cls.security_group_rules_client = (
- cls.os_primary.security_group_rules_client)
- # Use the latest available volume clients
+
+ cls.setup_compute_client(cls)
+ cls.setup_network_client(cls)
if CONF.service_available.cinder:
cls.volumes_client = cls.os_primary.volumes_client_latest
cls.snapshots_client = cls.os_primary.snapshots_client_latest
cls.backups_client = cls.os_primary.backups_client_latest
# ## Test functions library
- #
# The create_[resource] functions only return body and discard the
# resp part which is not used in scenario tests
def create_port(self, network_id, client=None, **kwargs):
+ """Creates port"""
if not client:
client = self.ports_client
name = data_utils.rand_name(self.__class__.__name__)
@@ -156,6 +161,13 @@
return port
def create_keypair(self, client=None):
+ """Creates keypair
+
+ Keypair is a public key of OpenSSH key pair used for accessing
+ and create servers
+ Keypair can also be created by a private key for the same purpose
+ Here, the keys are randomly generated[public/private]
+ """
if not client:
client = self.keypairs_client
name = data_utils.rand_name(self.__class__.__name__)
@@ -295,6 +307,13 @@
def create_volume(self, size=None, name=None, snapshot_id=None,
imageRef=None, volume_type=None):
+ """Creates volume
+
+ This wrapper utility creates volume and waits for volume to be
+ in 'available' state.
+ This method returns the volume's full representation by GET request.
+ """
+
if size is None:
size = CONF.volume.volume_size
if imageRef:
@@ -334,6 +353,11 @@
def create_backup(self, volume_id, name=None, description=None,
force=False, snapshot_id=None, incremental=False,
container=None):
+ """Creates backup
+
+ This wrapper utility creates backup and waits for backup to be
+ in 'available' state.
+ """
name = name or data_utils.rand_name(
self.__class__.__name__ + "-backup")
@@ -351,6 +375,12 @@
return backup
def restore_backup(self, backup_id):
+ """Restore backup
+
+ This wrapper utility restores backup and waits for backup to be
+ in 'available' state.
+ """
+
restore = self.backups_client.restore_backup(backup_id)['restore']
self.addCleanup(self.volumes_client.delete_volume,
restore['volume_id'])
@@ -362,8 +392,31 @@
self.assertEqual(backup_id, restore['backup_id'])
return restore
+ def rebuild_server(self, server_id, image=None,
+ preserve_ephemeral=False, wait=True,
+ rebuild_kwargs=None):
+ if image is None:
+ image = CONF.compute.image_ref
+ rebuild_kwargs = rebuild_kwargs or {}
+ LOG.debug("Rebuilding server (id: %s, image: %s, preserve eph: %s)",
+ server_id, image, preserve_ephemeral)
+ self.servers_client.rebuild_server(
+ server_id=server_id,
+ image_ref=image,
+ preserve_ephemeral=preserve_ephemeral,
+ **rebuild_kwargs)
+ if wait:
+ waiters.wait_for_server_status(self.servers_client,
+ server_id, 'ACTIVE')
+
def create_volume_snapshot(self, volume_id, name=None, description=None,
metadata=None, force=False):
+ """Creates volume
+
+ This wrapper utility creates volume snapshot and waits for backup
+ to be in 'available' state.
+ """
+
name = name or data_utils.rand_name(
self.__class__.__name__ + '-snapshot')
snapshot = self.snapshots_client.create_snapshot(
@@ -372,6 +425,7 @@
display_name=name,
description=description,
metadata=metadata)['snapshot']
+
self.addCleanup(self.snapshots_client.wait_for_resource_deletion,
snapshot['id'])
self.addCleanup(self.snapshots_client.delete_snapshot, snapshot['id'])
@@ -401,6 +455,23 @@
admin_volume_type_client.delete_volume_type(volume_type['id'])
def create_volume_type(self, client=None, name=None, backend_name=None):
+ """Creates volume type
+
+ In a multiple-storage back-end configuration,
+ each back end has a name (volume_backend_name).
+ The name of the back end is declared as an extra-specification
+ of a volume type (such as, volume_backend_name=LVM).
+ When a volume is created, the scheduler chooses an
+ appropriate back end to handle the request, according
+ to the volume type specified by the user.
+ The scheduler uses volume types to explicitly create volumes on
+ specific back ends.
+
+ Before using volume type, a volume type has to be declared
+ to Block Storage. In addition to that, an extra-specification
+ has to be created to link the volume type to a back end name.
+ """
+
if not client:
client = self.os_admin.volume_types_client_latest
if not name:
@@ -416,6 +487,7 @@
volume_type = client.create_volume_type(
name=randomized_name, extra_specs=extra_specs)['volume_type']
+ self.assertIn('id', volume_type)
self.addCleanup(self._cleanup_volume_type, volume_type)
return volume_type
@@ -456,7 +528,7 @@
return rules
def _create_security_group(self):
- # Create security group
+ """Create security group and add rules to security group"""
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
secgroup = self.compute_security_groups_client.create_security_group(
@@ -470,7 +542,6 @@
# Add rules to the security group
self._create_loginable_secgroup_rule(secgroup['id'])
-
return secgroup
def get_remote_client(self, ip_address, username=None, private_key=None,
@@ -555,6 +626,7 @@
return image['id']
def _log_console_output(self, servers=None, client=None):
+ """Console log output"""
if not CONF.compute_feature_enabled.console_output:
LOG.debug('Console output not supported, cannot log')
return
@@ -573,11 +645,12 @@
"for the console log", server['id'])
def _log_net_info(self, exc):
- # network debug is called as part of ssh init
+ """network debug is called as part of ssh init"""
if not isinstance(exc, lib_exc.SSHTimeout):
LOG.debug('Network information on a devstack host')
def create_server_snapshot(self, server, name=None):
+ """Creates server snapshot"""
# Glance client
_image_client = self.image_client
# Compute client
@@ -595,7 +668,7 @@
_image_client.delete_image, image_id)
if CONF.image_feature_enabled.api_v1:
- # In glance v1 the additional properties are stored in the headers.
+ # In glance v1 the additional properties are stored in the headers
resp = _image_client.check_image(image_id)
snapshot_image = common_image.get_image_meta_from_headers(resp)
image_props = snapshot_image.get('properties', {})
@@ -625,22 +698,34 @@
return snapshot_image
def nova_volume_attach(self, server, volume_to_attach):
+ """Compute volume attach
+
+ This utility attaches volume from compute and waits for the
+ volume status to be 'in-use' state.
+ """
volume = self.servers_client.attach_volume(
server['id'], volumeId=volume_to_attach['id'])['volumeAttachment']
self.assertEqual(volume_to_attach['id'], volume['id'])
waiters.wait_for_volume_resource_status(self.volumes_client,
volume['id'], 'in-use')
-
# Return the updated volume after the attachment
return self.volumes_client.show_volume(volume['id'])['volume']
def nova_volume_detach(self, server, volume):
+ """Compute volume detach
+
+ This utility detaches volume from compute and check whether the
+ volume status is 'available' state, and if not, an exception
+ will be thrown.
+ """
self.servers_client.detach_volume(server['id'], volume['id'])
waiters.wait_for_volume_resource_status(self.volumes_client,
volume['id'], 'available')
+ volume = self.volumes_client.show_volume(volume['id'])['volume']
def ping_ip_address(self, ip_address, should_succeed=True,
ping_timeout=None, mtu=None, server=None):
+ """ping ip address"""
timeout = ping_timeout or CONF.validation.ping_timeout
cmd = ['ping', '-c1', '-w1']
@@ -701,6 +786,7 @@
:raises: AssertError if the result of the connectivity check does
not match the value of the should_connect param
"""
+
LOG.debug('checking network connections to IP %s with user: %s',
ip_address, username)
if should_connect:
@@ -724,7 +810,7 @@
LOG.exception(extra_msg)
raise
- def create_floating_ip(self, thing, pool_name=None):
+ def create_floating_ip(self, server, pool_name=None):
"""Create a floating IP and associates to a server on Nova"""
if not pool_name:
@@ -735,11 +821,17 @@
self.compute_floating_ips_client.delete_floating_ip,
floating_ip['id'])
self.compute_floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], thing['id'])
+ floating_ip['ip'], server['id'])
return floating_ip
def create_timestamp(self, ip_address, dev_name=None, mount_path='/mnt',
private_key=None, server=None):
+ """Creates timestamp
+
+ This wrapper utility does ssh, creates timestamp and returns the
+ created timestamp.
+ """
+
ssh_client = self.get_remote_client(ip_address,
private_key=private_key,
server=server)
@@ -757,6 +849,11 @@
def get_timestamp(self, ip_address, dev_name=None, mount_path='/mnt',
private_key=None, server=None):
+ """Returns timestamp
+
+ This wrapper utility does ssh and returns the timestamp.
+ """
+
ssh_client = self.get_remote_client(ip_address,
private_key=private_key,
server=server)
@@ -774,6 +871,7 @@
Based on the configuration we're in, return a correct ip
address for validating that a guest is up.
"""
+
if CONF.validation.connect_method == 'floating':
# The tests calling this method don't have a floating IP
# and can't make use of the validation resources. So the
@@ -799,6 +897,8 @@
@classmethod
def get_host_for_server(cls, server_id):
+ """Gets host of server"""
+
server_details = cls.os_admin.servers_client.show_server(server_id)
return server_details['server']['OS-EXT-SRV-ATTR:host']
@@ -817,6 +917,12 @@
security_group=None,
delete_on_termination=False,
name=None):
+ """Boot instance from resource
+
+ This wrapper utility boots instance from resource with block device
+ mapping with source info passed in arguments
+ """
+
create_kwargs = dict()
if keypair:
create_kwargs['key_name'] = keypair['name']
@@ -833,6 +939,7 @@
return self.create_server(image_id='', **create_kwargs)
def create_volume_from_image(self):
+ """Create volume from image"""
img_uuid = CONF.compute.image_ref
vol_name = data_utils.rand_name(
self.__class__.__name__ + '-volume-origin')
@@ -888,8 +995,17 @@
namestart='subnet-smoke', **kwargs):
"""Create a subnet for the given network
+ This utility creates subnet for the given network
within the cidr block configured for tenant networks.
+
+ :param **kwargs:
+ See extra parameters below
+
+ :Keyword Arguments:
+
+ * *ip_version = ip version of the given network,
"""
+
if not subnets_client:
subnets_client = self.subnets_client
@@ -992,22 +1108,23 @@
"Unable to get network by name: %s" % network_name)
return net[0]
- def create_floating_ip(self, thing, external_network_id=None,
+ def create_floating_ip(self, server, external_network_id=None,
port_id=None, client=None):
"""Create a floating IP and associates to a resource/port on Neutron"""
+
if not external_network_id:
external_network_id = CONF.network.public_network_id
if not client:
client = self.floating_ips_client
if not port_id:
- port_id, ip4 = self._get_server_port_id_and_ip4(thing)
+ port_id, ip4 = self._get_server_port_id_and_ip4(server)
else:
ip4 = None
kwargs = {
'floating_network_id': external_network_id,
'port_id': port_id,
- 'tenant_id': thing.get('project_id') or thing['tenant_id'],
+ 'tenant_id': server.get('project_id') or server['tenant_id'],
'fixed_ip_address': ip4,
}
if CONF.network.subnet_id:
@@ -1027,6 +1144,7 @@
:param status: target status
:raises: AssertionError if status doesn't match
"""
+
floatingip_id = floating_ip['id']
def refresh():
@@ -1053,6 +1171,7 @@
private_key,
should_connect=True,
servers_for_debug=None):
+ """Checks tenant network connectivity"""
if not CONF.network.project_networks_reachable:
msg = 'Tenant networks not configured to be reachable.'
LOG.info(msg)
@@ -1085,6 +1204,7 @@
:returns: True, if the connection succeeded and it was expected to
succeed. False otherwise.
"""
+
method_name = '%s_check' % protocol
connectivity_checker = getattr(source, method_name)
@@ -1148,6 +1268,7 @@
:param project_id: secgroup will be created in this project
:returns: the created security group
"""
+
if client is None:
client = self.security_groups_client
if not project_id:
@@ -1189,6 +1310,7 @@
port_range_max: 22
}
"""
+
if sec_group_rules_client is None:
sec_group_rules_client = self.security_group_rules_client
if security_groups_client is None:
@@ -1279,6 +1401,7 @@
network has, a tenant router will be created and returned that
routes traffic to the public network.
"""
+
if not client:
client = self.routers_client
if not project_id:
@@ -1319,6 +1442,7 @@
'provider:segmentation_id': '42'}
:returns: network, subnet, router
"""
+
if CONF.network.shared_physical_network:
# NOTE(Shrews): This exception is for environments where tenant
# credential isolation is available, but network separation is
@@ -1375,6 +1499,7 @@
def create_encryption_type(self, client=None, type_id=None, provider=None,
key_size=None, cipher=None,
control_location=None):
+ """Creates an encryption type for volume"""
if not client:
client = self.admin_encryption_types_client
if not type_id:
@@ -1388,6 +1513,7 @@
def create_encrypted_volume(self, encryption_provider, volume_type,
key_size=256, cipher='aes-xts-plain64',
control_location='front-end'):
+ """Creates an encrypted volume"""
volume_type = self.create_volume_type(name=volume_type)
self.create_encryption_type(type_id=volume_type['id'],
provider=encryption_provider,
@@ -1428,11 +1554,12 @@
cls.object_client = cls.os_operator.object_client
def get_swift_stat(self):
- """get swift status for our user account."""
+ """Get swift status for our user account."""
self.account_client.list_account_containers()
LOG.debug('Swift status information obtained successfully')
def create_container(self, container_name=None):
+ """Creates container"""
name = container_name or data_utils.rand_name(
'swift-scenario-container')
self.container_client.update_container(name)
@@ -1445,10 +1572,12 @@
return name
def delete_container(self, container_name):
+ """Deletes container"""
self.container_client.delete_container(container_name)
LOG.debug('Container %s deleted', container_name)
def upload_object_to_container(self, container_name, obj_name=None):
+ """Uploads object to container"""
obj_name = obj_name or data_utils.rand_name('swift-scenario-object')
obj_data = data_utils.random_bytes()
self.object_client.create_object(container_name, obj_name, obj_data)
@@ -1459,6 +1588,7 @@
return obj_name, obj_data
def delete_object(self, container_name, filename):
+ """Deletes object"""
self.object_client.delete_object(container_name, filename)
self.list_and_check_container_objects(container_name,
not_present_obj=[filename])
@@ -1466,8 +1596,13 @@
def list_and_check_container_objects(self, container_name,
present_obj=None,
not_present_obj=None):
- # List objects for a given container and assert which are present and
- # which are not.
+ """List and verify objects for a given container
+
+ This utility lists objects for a given container
+ and asserts which are present and
+ which are not
+ """
+
if present_obj is None:
present_obj = []
if not_present_obj is None:
@@ -1482,5 +1617,6 @@
self.assertNotIn(obj, object_list)
def download_and_verify(self, container_name, obj_name, expected_data):
+ """Asserts the object and expected data to verify if they are same"""
_, obj = self.object_client.get_object(container_name, obj_name)
self.assertEqual(obj, expected_data)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 8de6614..14f24c7 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -130,7 +130,7 @@
key_name=self.keypair['name'],
security_groups=[{'name': self.sec_grp['name']}],
networks=[{'uuid': n['id']} for n in networks])
- fip = self.create_floating_ip(thing=srv)
+ fip = self.create_floating_ip(server=srv)
ips = self.define_server_ips(srv=srv)
ssh = self.get_remote_client(
ip_address=fip['floating_ip_address'],
diff --git a/tempest/tests/lib/services/volume/v3/test_backups_client.py b/tempest/tests/lib/services/volume/v3/test_backups_client.py
index 97e1132..ca7918a 100644
--- a/tempest/tests/lib/services/volume/v3/test_backups_client.py
+++ b/tempest/tests/lib/services/volume/v3/test_backups_client.py
@@ -45,6 +45,8 @@
"availability_zone": "az1",
"container": "volumebackups",
"created_at": "2013-04-02T10:35:27.000000",
+ "updated_at": "2013-04-02T10:39:27.000000",
+ "data_timestamp": "2013-04-02T10:35:27.000000",
"description": None,
"fail_reason": None,
"id": "2ef47aee-8844-490c-804d-2a8efe561c65",
@@ -64,7 +66,6 @@
"user_id": "515ba0dd59f84f25a6a084a45d8d93b2",
"size": 1,
"status": "available",
- "updated_at": "2013-04-02T10:35:27.000000",
"volume_id": "e5185058-943a-4cb4-96d9-72c184c337d6",
"is_incremental": True,
"has_dependent_backups": False
diff --git a/tools/generate-tempest-plugins-list.py b/tools/generate-tempest-plugins-list.py
index 530ce5e..618c388 100644
--- a/tools/generate-tempest-plugins-list.py
+++ b/tools/generate-tempest-plugins-list.py
@@ -41,7 +41,7 @@
'x/intel-nfv-ci-tests', # https://review.opendev.org/#/c/634640/
'openstack/networking-generic-switch',
# https://review.opendev.org/#/c/634846/
- 'openstack/networking-l2gw-tempest-plugin',
+ 'x/networking-l2gw-tempest-plugin',
# https://review.opendev.org/#/c/635093/
'openstack/networking-midonet', # https://review.opendev.org/#/c/635096/
'x/networking-plumgrid', # https://review.opendev.org/#/c/635096/