Merge "Adding description for testcases - compute part4"
diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index 36828d6..d239149 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -27,6 +27,6 @@
@decorators.idempotent_id('a8333aa2-205c-449f-a828-d38c2489bf25')
def test_get_availability_zone_list_with_non_admin_user(self):
- # List of availability zone with non-administrator user
+ """List of availability zone with non-administrator user"""
availability_zone = self.client.list_availability_zones()
self.assertNotEmpty(availability_zone['availabilityZoneInfo'])
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 4f0dbad..48f32a8 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -27,6 +27,11 @@
class ServersTestJSON(base.BaseV2ComputeTest):
+ """Test creating server and verifying the server attributes
+
+ This is to create server booted from image and with disk_config 'AUTO'
+ """
+
disk_config = 'AUTO'
volume_backed = False
@@ -62,13 +67,12 @@
disk_config=disk_config,
adminPass=cls.password,
volume_backed=cls.volume_backed)
- cls.server = (cls.client.show_server(server_initial['id'])
- ['server'])
+ cls.server = cls.client.show_server(server_initial['id'])['server']
@decorators.attr(type='smoke')
@decorators.idempotent_id('5de47127-9977-400a-936f-abcfbec1218f')
def test_verify_server_details(self):
- # Verify the specified server attributes are set correctly
+ """Verify the specified server attributes are set correctly"""
self.assertEqual(self.accessIPv4, self.server['accessIPv4'])
# NOTE(maurosr): See http://tools.ietf.org/html/rfc5952 (section 4)
# Here we compare directly with the canonicalized format.
@@ -86,7 +90,7 @@
@decorators.attr(type='smoke')
@decorators.idempotent_id('9a438d88-10c6-4bcd-8b5b-5b6e25e1346f')
def test_list_servers(self):
- # The created server should be in the list of all servers
+ """The created server should be in the list of all servers"""
body = self.client.list_servers()
servers = body['servers']
found = [i for i in servers if i['id'] == self.server['id']]
@@ -94,7 +98,7 @@
@decorators.idempotent_id('585e934c-448e-43c4-acbf-d06a9b899997')
def test_list_servers_with_detail(self):
- # The created server should be in the detailed list of all servers
+ """The created server should be in the detailed list of all servers"""
body = self.client.list_servers(detail=True)
servers = body['servers']
found = [i for i in servers if i['id'] == self.server['id']]
@@ -104,8 +108,11 @@
@testtools.skipUnless(CONF.validation.run_validation,
'Instance validation tests are disabled.')
def test_verify_created_server_vcpus(self):
- # Verify that the number of vcpus reported by the instance matches
- # the amount stated by the flavor
+ """The created server should have the same specification as the flavor
+
+ Verify that the number of vcpus reported by the instance matches
+ the amount stated by the flavor
+ """
flavor = self.flavors_client.show_flavor(self.flavor_ref)['flavor']
validation_resources = self.get_class_validation_resources(
self.os_primary)
@@ -123,7 +130,7 @@
@testtools.skipUnless(CONF.validation.run_validation,
'Instance validation tests are disabled.')
def test_host_name_is_same_as_server_name(self):
- # Verify the instance host name is the same as the server name
+ """Verify the instance host name is the same as the server name"""
validation_resources = self.get_class_validation_resources(
self.os_primary)
linux_client = remote_client.RemoteClient(
@@ -145,6 +152,10 @@
class ServersTestManualDisk(ServersTestJSON):
+ """Test creating server and verifying the server attributes
+
+ This is to create server booted from image and with disk_config 'MANUAL'
+ """
disk_config = 'MANUAL'
@classmethod
@@ -156,7 +167,11 @@
class ServersTestBootFromVolume(ServersTestJSON):
- """Run the `ServersTestJSON` tests with a volume backed VM"""
+ """Test creating server and verifying the server attributes
+
+ This is to create server booted from volume and with disk_config 'AUTO'
+ """
+ # Run the `ServersTestJSON` tests with a volume backed VM
volume_backed = True
@classmethod
diff --git a/tempest/api/compute/servers/test_disk_config.py b/tempest/api/compute/servers/test_disk_config.py
index 5b8e7ab..e5e051a 100644
--- a/tempest/api/compute/servers/test_disk_config.py
+++ b/tempest/api/compute/servers/test_disk_config.py
@@ -24,6 +24,8 @@
class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
+ """Test disk config option of server"""
+
create_default_network = True
@classmethod
@@ -49,7 +51,7 @@
@decorators.idempotent_id('bef56b09-2e8c-4883-a370-4950812f430e')
def test_rebuild_server_with_manual_disk_config(self):
- # A server should be rebuilt using the manual disk config option
+ """A server should be rebuilt using the manual disk config option"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.client.delete_server, server['id'])
self._update_server_with_disk_config(server['id'],
@@ -68,7 +70,7 @@
@decorators.idempotent_id('9c9fae77-4feb-402f-8450-bf1c8b609713')
def test_rebuild_server_with_auto_disk_config(self):
- # A server should be rebuilt using the auto disk config option
+ """A server should be rebuilt using the auto disk config option"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.client.delete_server, server['id'])
self._update_server_with_disk_config(server['id'],
@@ -89,7 +91,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_resize_server_from_manual_to_auto(self):
- # A server should be resized from manual to auto disk config
+ """A server should be resized from manual to auto disk config"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.client.delete_server, server['id'])
self._update_server_with_disk_config(server['id'],
@@ -105,7 +107,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_resize_server_from_auto_to_manual(self):
- # A server should be resized from auto to manual disk config
+ """A server should be resized from auto to manual disk config"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.client.delete_server, server['id'])
self._update_server_with_disk_config(server['id'],
@@ -119,7 +121,7 @@
@decorators.idempotent_id('5ef18867-358d-4de9-b3c9-94d4ba35742f')
def test_update_server_from_auto_to_manual(self):
- # A server should be updated from auto to manual disk config
+ """A server should be updated from auto to manual disk config"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.client.delete_server, server['id'])
self._update_server_with_disk_config(server['id'],
diff --git a/tempest/api/compute/servers/test_list_server_filters.py b/tempest/api/compute/servers/test_list_server_filters.py
index 3dffd01..7f62c64 100644
--- a/tempest/api/compute/servers/test_list_server_filters.py
+++ b/tempest/api/compute/servers/test_list_server_filters.py
@@ -26,6 +26,7 @@
class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
+ """Test listing servers filtered by specified attribute"""
@classmethod
def setup_credentials(cls):
@@ -71,7 +72,7 @@
@testtools.skipUnless(CONF.compute.image_ref != CONF.compute.image_ref_alt,
"Need distinct images to run this test")
def test_list_servers_filter_by_image(self):
- # Filter the list of servers by image
+ """Filter the list of servers by image"""
params = {'image': self.image_ref}
body = self.client.list_servers(**params)
servers = body['servers']
@@ -82,7 +83,7 @@
@decorators.idempotent_id('573637f5-7325-47bb-9144-3476d0416908')
def test_list_servers_filter_by_flavor(self):
- # Filter the list of servers by flavor
+ """Filter the list of servers by flavor"""
params = {'flavor': self.flavor_ref_alt}
body = self.client.list_servers(**params)
servers = body['servers']
@@ -93,7 +94,7 @@
@decorators.idempotent_id('9b067a7b-7fee-4f6a-b29c-be43fe18fc5a')
def test_list_servers_filter_by_server_name(self):
- # Filter the list of servers by server name
+ """Filter the list of servers by server name"""
params = {'name': self.s1_name}
body = self.client.list_servers(**params)
servers = body['servers']
@@ -104,7 +105,7 @@
@decorators.idempotent_id('ca78e20e-fddb-4ce6-b7f7-bcbf8605e66e')
def test_list_servers_filter_by_active_status(self):
- # Filter the list of servers by server active status
+ """Filter the list of servers by server active status"""
params = {'status': 'active'}
body = self.client.list_servers(**params)
servers = body['servers']
@@ -115,7 +116,7 @@
@decorators.idempotent_id('451dbbb2-f330-4a9f-b0e1-5f5d2cb0f34c')
def test_list_servers_filter_by_shutoff_status(self):
- # Filter the list of servers by server shutoff status
+ """Filter the list of servers by server shutoff status"""
params = {'status': 'shutoff'}
self.client.stop_server(self.s1['id'])
waiters.wait_for_server_status(self.client, self.s1['id'],
@@ -132,21 +133,30 @@
@decorators.idempotent_id('614cdfc1-d557-4bac-915b-3e67b48eee76')
def test_list_servers_filter_by_limit(self):
- # Verify only the expected number of servers are returned
+ """Filter the list of servers by limit 1
+
+ Verify only the expected number of servers are returned (one server)
+ """
params = {'limit': 1}
servers = self.client.list_servers(**params)
self.assertEqual(1, len([x for x in servers['servers'] if 'id' in x]))
@decorators.idempotent_id('b1495414-2d93-414c-8019-849afe8d319e')
def test_list_servers_filter_by_zero_limit(self):
- # Verify only the expected number of servers are returned
+ """Filter the list of servers by limit 0
+
+ Verify only the expected number of servers are returned (no server)
+ """
params = {'limit': 0}
servers = self.client.list_servers(**params)
self.assertEmpty(servers['servers'])
@decorators.idempotent_id('37791bbd-90c0-4de0-831e-5f38cba9c6b3')
def test_list_servers_filter_by_exceed_limit(self):
- # Verify only the expected number of servers are returned
+ """Filter the list of servers by exceeded limit
+
+ Verify only the expected number of servers are returned (all servers)
+ """
params = {'limit': 100000}
servers = self.client.list_servers(**params)
all_servers = self.client.list_servers()
@@ -157,7 +167,7 @@
@testtools.skipUnless(CONF.compute.image_ref != CONF.compute.image_ref_alt,
"Need distinct images to run this test")
def test_list_servers_detailed_filter_by_image(self):
- # Filter the detailed list of servers by image
+ """"Filter the detailed list of servers by image"""
params = {'image': self.image_ref}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@@ -168,7 +178,7 @@
@decorators.idempotent_id('80c574cc-0925-44ba-8602-299028357dd9')
def test_list_servers_detailed_filter_by_flavor(self):
- # Filter the detailed list of servers by flavor
+ """Filter the detailed list of servers by flavor"""
params = {'flavor': self.flavor_ref_alt}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@@ -179,7 +189,7 @@
@decorators.idempotent_id('f9eb2b70-735f-416c-b260-9914ac6181e4')
def test_list_servers_detailed_filter_by_server_name(self):
- # Filter the detailed list of servers by server name
+ """Filter the detailed list of servers by server name"""
params = {'name': self.s1_name}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@@ -190,7 +200,7 @@
@decorators.idempotent_id('de2612ab-b7dd-4044-b0b1-d2539601911f')
def test_list_servers_detailed_filter_by_server_status(self):
- # Filter the detailed list of servers by server status
+ """Filter the detailed list of servers by server status"""
params = {'status': 'active'}
body = self.client.list_servers(detail=True, **params)
servers = body['servers']
@@ -204,6 +214,7 @@
@decorators.idempotent_id('e9f624ee-92af-4562-8bec-437945a18dcb')
def test_list_servers_filtered_by_name_wildcard(self):
+ """Filter the list of servers by part of server name"""
# List all servers that contains '-instance' in name
params = {'name': '-instance'}
body = self.client.list_servers(**params)
@@ -226,6 +237,7 @@
@decorators.idempotent_id('24a89b0c-0d55-4a28-847f-45075f19b27b')
def test_list_servers_filtered_by_name_regex(self):
+ """Filter the list of servers by server name regular expression"""
# list of regex that should match s1, s2 and s3
regexes = [r'^.*\-instance\-[0-9]+$', r'^.*\-instance\-.*$']
for regex in regexes:
@@ -250,7 +262,7 @@
@decorators.idempotent_id('43a1242e-7b31-48d1-88f2-3f72aa9f2077')
def test_list_servers_filtered_by_ip(self):
- # Filter servers by ip
+ """Filter the list of servers by server ip address"""
# Here should be listed 1 server
if not self.fixed_network_name:
msg = 'fixed_network_name needs to be configured to run this test'
@@ -287,8 +299,7 @@
@decorators.skip_because(bug="1540645")
@decorators.idempotent_id('a905e287-c35e-42f2-b132-d02b09f3654a')
def test_list_servers_filtered_by_ip_regex(self):
- # Filter servers by regex ip
- # List all servers filtered by part of ip address.
+ """Filter the list of servers by part of server ip address"""
# Here should be listed all servers
if not self.fixed_network_name:
msg = 'fixed_network_name needs to be configured to run this test'
@@ -317,7 +328,10 @@
@decorators.idempotent_id('67aec2d0-35fe-4503-9f92-f13272b867ed')
def test_list_servers_detailed_limit_results(self):
- # Verify only the expected number of detailed results are returned
+ """Filter the detailed list of servers by limit 1
+
+ Verify only the expected number of servers are returned (one server)
+ """
params = {'limit': 1}
servers = self.client.list_servers(detail=True, **params)
self.assertEqual(1, len(servers['servers']))
diff --git a/tempest/api/compute/servers/test_novnc.py b/tempest/api/compute/servers/test_novnc.py
index 68e09e7..7931ca9 100644
--- a/tempest/api/compute/servers/test_novnc.py
+++ b/tempest/api/compute/servers/test_novnc.py
@@ -33,6 +33,8 @@
class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
+ """Test novnc console"""
+
create_default_network = True
@classmethod
@@ -181,6 +183,7 @@
@decorators.idempotent_id('c640fdff-8ab4-45a4-a5d8-7e6146cbd0dc')
def test_novnc(self):
+ """Test accessing novnc console of server"""
if self.use_get_remote_console:
body = self.client.get_remote_console(
self.server['id'], console_type='novnc',
@@ -200,6 +203,11 @@
@decorators.idempotent_id('f9c79937-addc-4aaa-9e0e-841eef02aeb7')
def test_novnc_bad_token(self):
+ """Test accessing novnc console with bad token
+
+ Do the WebSockify HTTP Request to novnc proxy with a bad token,
+ the novnc proxy should reject the connection and closed it.
+ """
if self.use_get_remote_console:
body = self.client.get_remote_console(
self.server['id'], console_type='novnc',
diff --git a/tempest/api/compute/servers/test_server_addresses_negative.py b/tempest/api/compute/servers/test_server_addresses_negative.py
index f33c6d9..e7444d2 100644
--- a/tempest/api/compute/servers/test_server_addresses_negative.py
+++ b/tempest/api/compute/servers/test_server_addresses_negative.py
@@ -20,6 +20,7 @@
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
+ """Negative tests of listing server addresses"""
create_default_network = True
@classmethod
@@ -36,7 +37,7 @@
@decorators.idempotent_id('02c3f645-2d2e-4417-8525-68c0407d001b')
@utils.services('network')
def test_list_server_addresses_invalid_server_id(self):
- # List addresses request should fail if server id not in system
+ """List addresses request should fail if server id not in system"""
self.assertRaises(lib_exc.NotFound, self.client.list_addresses,
'999')
@@ -44,7 +45,7 @@
@decorators.idempotent_id('a2ab5144-78c0-4942-a0ed-cc8edccfd9ba')
@utils.services('network')
def test_list_server_addresses_by_network_neg(self):
- # List addresses by network should fail if network name not valid
+ """List addresses by network should fail if network name not valid"""
self.assertRaises(lib_exc.NotFound,
self.client.list_addresses_by_network,
self.server['id'], 'invalid')
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index 4f484e2..ba2adbb 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -28,6 +28,7 @@
class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
+ """Test servers with injected files"""
@classmethod
def setup_credentials(cls):
@@ -51,6 +52,7 @@
@decorators.attr(type='slow')
@decorators.idempotent_id('3cfe87fd-115b-4a02-b942-7dc36a337fdf')
def test_create_server_with_personality(self):
+ """Test creating server with file injection"""
file_contents = 'This is a test file.'
file_path = '/test.txt'
personality = [{'path': file_path,
@@ -85,6 +87,7 @@
@decorators.attr(type='slow')
@decorators.idempotent_id('128966d8-71fc-443c-8cab-08e24114ecc9')
def test_rebuild_server_with_personality(self):
+ """Test injecting file when rebuilding server"""
validation_resources = self.get_test_validation_resources(
self.os_primary)
server = self.create_test_server(
@@ -107,8 +110,11 @@
@decorators.idempotent_id('176cd8c9-b9e8-48ee-a480-180beab292bf')
def test_personality_files_exceed_limit(self):
- # Server creation should fail if greater than the maximum allowed
- # number of files are injected into the server.
+ """Test creating server with injected files over limitation
+
+ Server creation should fail if greater than the maximum allowed
+ number of files are injected into the server.
+ """
file_contents = 'This is a test file.'
personality = []
limits = self.limits_client.show_limits()['limits']
@@ -131,8 +137,11 @@
@decorators.attr(type='slow')
@decorators.idempotent_id('52f12ee8-5180-40cc-b417-31572ea3d555')
def test_can_create_server_with_max_number_personality_files(self):
- # Server should be created successfully if maximum allowed number of
- # files is injected into the server during creation.
+ """Test creating server with maximum allowed number of injected files
+
+ Server should be created successfully if maximum allowed number of
+ files is injected into the server during creation.
+ """
file_contents = 'This is a test file.'
limits = self.limits_client.show_limits()['limits']
max_file_limit = limits['absolute']['maxPersonality']
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index caceb64..9bcf062 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -27,6 +27,7 @@
class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
+ """Negative tests of server rescue"""
@classmethod
def skip_checks(cls):
@@ -75,7 +76,7 @@
'Pause is not available.')
@decorators.attr(type=['negative'])
def test_rescue_paused_instance(self):
- # Rescue a paused server
+ """Test rescuing a paused server should fail"""
self.servers_client.pause_server(self.server_id)
self.addCleanup(self._unpause, self.server_id)
waiters.wait_for_server_status(self.servers_client,
@@ -87,13 +88,14 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('db22b618-f157-4566-a317-1b6d467a8094')
def test_rescued_vm_reboot(self):
+ """Test rebooing a rescued server should fail"""
self.assertRaises(lib_exc.Conflict, self.servers_client.reboot_server,
self.rescue_id, type='HARD')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6dfc0a55-3a77-4564-a144-1587b7971dde')
def test_rescue_non_existent_server(self):
- # Rescue a non-existing server
+ """Test rescuing a non-existing server should fail"""
non_existent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.servers_client.rescue_server,
@@ -102,6 +104,7 @@
@decorators.attr(type=['negative'])
@decorators.idempotent_id('70cdb8a1-89f8-437d-9448-8844fd82bf46')
def test_rescued_vm_rebuild(self):
+ """Test rebuilding a rescued server should fail"""
self.assertRaises(lib_exc.Conflict,
self.servers_client.rebuild_server,
self.rescue_id,
@@ -111,6 +114,7 @@
@utils.services('volume')
@decorators.attr(type=['negative'])
def test_rescued_vm_attach_volume(self):
+ """Test attaching volume to a rescued server should fail"""
volume = self.create_volume()
# Rescue the server
@@ -130,6 +134,7 @@
@utils.services('volume')
@decorators.attr(type=['negative'])
def test_rescued_vm_detach_volume(self):
+ """Test detaching volume from a rescued server should fail"""
volume = self.create_volume()
# Attach the volume to the server
diff --git a/tempest/api/compute/servers/test_server_tags.py b/tempest/api/compute/servers/test_server_tags.py
index 3893b01..619f480 100644
--- a/tempest/api/compute/servers/test_server_tags.py
+++ b/tempest/api/compute/servers/test_server_tags.py
@@ -22,6 +22,7 @@
class ServerTagsTestJSON(base.BaseV2ComputeTest):
+ """Test server tags with compute microversion greater than 2.25"""
min_microversion = '2.26'
max_microversion = 'latest'
@@ -54,6 +55,7 @@
@decorators.idempotent_id('8d95abe2-c658-4c42-9a44-c0258500306b')
def test_create_delete_tag(self):
+ """Test creating and deleting server tag"""
# Check that no tags exist.
fetched_tags = self.client.list_tags(self.server['id'])['tags']
self.assertEmpty(fetched_tags)
@@ -73,6 +75,7 @@
@decorators.idempotent_id('a2c1af8c-127d-417d-974b-8115f7e3d831')
def test_update_all_tags(self):
+ """Test updating all server tags"""
# Add server tags to the server.
tags = [data_utils.rand_name('tag'), data_utils.rand_name('tag')]
self._update_server_tags(self.server['id'], tags)
@@ -89,6 +92,7 @@
@decorators.idempotent_id('a63b2a74-e918-4b7c-bcab-10c855f3a57e')
def test_delete_all_tags(self):
+ """Test deleting all server tags"""
# Add server tags to the server.
assigned_tags = [data_utils.rand_name('tag'),
data_utils.rand_name('tag')]
@@ -101,6 +105,7 @@
@decorators.idempotent_id('81279a66-61c3-4759-b830-a2dbe64cbe08')
def test_check_tag_existence(self):
+ """Test checking server tag existence"""
# Add server tag to the server.
assigned_tag = data_utils.rand_name('tag')
self._update_server_tags(self.server['id'], assigned_tag)