Adding description for testcases - compute part4

When Tempest is used in customer site, often we are required to
provide a testcase list including testcase names and descriptions.
Now no this kind of doc is available, so we can add descriptions
with the format of doc string for every testcase, so later we
can generata such a testcase description list.

There are hundreds of testcases missing descriptions, so we can
add them gradually, and limit the modified files in one patch
for the convenience of reviewing.

Change-Id: If14b4ec678355c850275ef38f9ed70cc0c877946
partially-implements: blueprint testcase-description
This commit is contained in:
zhufl 2020-05-25 13:35:12 +08:00
parent f004447315
commit 67b3d38934
9 changed files with 98 additions and 39 deletions

View File

@ -27,6 +27,6 @@ class AZV2TestJSON(base.BaseV2ComputeTest):
@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'])

View File

@ -27,6 +27,11 @@ CONF = config.CONF
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 @@ class ServersTestJSON(base.BaseV2ComputeTest):
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 @@ class ServersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServersTestJSON(base.BaseV2ComputeTest):
@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 ServersTestJSON(base.BaseV2ComputeTest):
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 ServersTestManualDisk(ServersTestJSON):
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

View File

@ -24,6 +24,8 @@ CONF = config.CONF
class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
"""Test disk config option of server"""
create_default_network = True
@classmethod
@ -49,7 +51,7 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerDiskConfigTestJSON(base.BaseV2ComputeTest):
@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'],

View File

@ -26,6 +26,7 @@ CONF = config.CONF
class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
"""Test listing servers filtered by specified attribute"""
@classmethod
def setup_credentials(cls):
@ -71,7 +72,7 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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 @@ class ListServerFiltersTestJSON(base.BaseV2ComputeTest):
@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']))

View File

@ -33,6 +33,8 @@ else:
class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
"""Test novnc console"""
create_default_network = True
@classmethod
@ -181,6 +183,7 @@ class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
@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 @@ class NoVNCConsoleTestJSON(base.BaseV2ComputeTest):
@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',

View File

@ -20,6 +20,7 @@ from tempest.lib import exceptions as lib_exc
class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of listing server addresses"""
create_default_network = True
@classmethod
@ -36,7 +37,7 @@ class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerAddressesNegativeTestJSON(base.BaseV2ComputeTest):
@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')

View File

@ -28,6 +28,7 @@ CONF = config.CONF
class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
"""Test servers with injected files"""
@classmethod
def setup_credentials(cls):
@ -51,6 +52,7 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
@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']

View File

@ -27,6 +27,7 @@ CONF = config.CONF
class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of server rescue"""
@classmethod
def skip_checks(cls):
@ -75,7 +76,7 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
'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 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerRescueNegativeTestJSON(base.BaseV2ComputeTest):
@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

View File

@ -22,6 +22,7 @@ from tempest.lib import decorators
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 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
@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 @@ class ServerTagsTestJSON(base.BaseV2ComputeTest):
@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)