Merge "Adding description for testcases - compute part5"

This commit is contained in:
Zuul 2020-07-30 18:08:58 +00:00 committed by Gerrit Code Review
commit 82697e9253
10 changed files with 225 additions and 104 deletions

View File

@ -25,6 +25,8 @@ CONF = config.CONF
class ImagesTestJSON(base.BaseV2ComputeTest):
"""Test server images"""
create_default_network = True
@classmethod
@ -48,6 +50,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('aa06b52b-2db5-4807-b218-9441f75d74e3')
def test_delete_saving_image(self):
"""Test deleting server image while it is in 'SAVING' state"""
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.servers_client.delete_server, server['id'])
# wait for server active to avoid conflict when deleting server
@ -74,6 +77,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('aaacd1d0-55a2-4ce8-818a-b5439df8adc9')
def test_create_image_from_stopped_server(self):
"""Test creating server image from stopped server"""
server = self.create_test_server(wait_until='ACTIVE')
self.servers_client.stop_server(server['id'])
waiters.wait_for_server_status(self.servers_client,
@ -91,6 +95,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
def test_create_image_from_paused_server(self):
"""Test creating server image from paused server"""
server = self.create_test_server(wait_until='ACTIVE')
self.servers_client.pause_server(server['id'])
waiters.wait_for_server_status(self.servers_client,
@ -109,6 +114,7 @@ class ImagesTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
def test_create_image_from_suspended_server(self):
"""Test creating server image from suspended server"""
server = self.create_test_server(wait_until='ACTIVE')
self.servers_client.suspend_server(server['id'])
waiters.wait_for_server_status(self.servers_client,

View File

@ -42,11 +42,12 @@ class ImagesNegativeTestBase(base.BaseV2ComputeTest):
class ImagesNegativeTestJSON(ImagesNegativeTestBase):
"""Negative tests of server image"""
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6cd5a89d-5b47-46a7-93bc-3916f0d84973')
def test_create_image_from_deleted_server(self):
# An image should not be created if the server instance is removed
"""Check server image should not be created if the server is removed"""
server = self.create_test_server(wait_until='ACTIVE')
# Delete server before trying to create image
@ -61,7 +62,7 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('82c5b0c4-9dbd-463c-872b-20c4755aae7f')
def test_create_image_from_invalid_server(self):
# An image should not be created with invalid server id
"""Check server image should not be created with invalid server id"""
# Create a new image with invalid server id
meta = {'image_type': 'test'}
self.assertRaises(lib_exc.NotFound, self.create_image_from_server,
@ -70,7 +71,10 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ec176029-73dc-4037-8d72-2e4ff60cf538')
def test_create_image_specify_uuid_35_characters_or_less(self):
# Return an error if Image ID passed is 35 characters or less
"""Check server image should not be created for invalid server id
Return an error if server id passed is 35 characters or less
"""
snapshot_name = data_utils.rand_name('test-snap')
test_uuid = ('a' * 35)
self.assertRaises(lib_exc.NotFound, self.client.create_image,
@ -79,7 +83,10 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('36741560-510e-4cc2-8641-55fe4dfb2437')
def test_create_image_specify_uuid_37_characters_or_more(self):
# Return an error if Image ID passed is 37 characters or more
"""Check server image should not be created for invalid server id
Return an error if sever id passed is 37 characters or more
"""
snapshot_name = data_utils.rand_name('test-snap')
test_uuid = ('a' * 37)
self.assertRaises(lib_exc.NotFound, self.client.create_image,
@ -87,20 +94,23 @@ class ImagesNegativeTestJSON(ImagesNegativeTestBase):
class ImagesDeleteNegativeTestJSON(ImagesNegativeTestBase):
"""Negative tests of server image
Negative tests of server image with compute microversion less than 2.36.
"""
max_microversion = '2.35'
@decorators.attr(type=['negative'])
@decorators.idempotent_id('381acb65-785a-4942-94ce-d8f8c84f1f0f')
def test_delete_image_with_invalid_image_id(self):
# An image should not be deleted with invalid image id
"""Check an image should not be deleted with invalid image id"""
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
data_utils.rand_name('invalid'))
@decorators.attr(type=['negative'])
@decorators.idempotent_id('137aef61-39f7-44a1-8ddf-0adf82511701')
def test_delete_non_existent_image(self):
# Return an error while trying to delete a non-existent image
"""Check trying to delete a non-existent image should fail"""
non_existent_image_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
non_existent_image_id)
@ -108,13 +118,13 @@ class ImagesDeleteNegativeTestJSON(ImagesNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('e6e41425-af5c-4fe6-a4b5-7b7b963ffda5')
def test_delete_image_blank_id(self):
# Return an error while trying to delete an image with blank Id
"""Check trying to delete an image with blank id should fail"""
self.assertRaises(lib_exc.NotFound, self.client.delete_image, '')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('924540c3-f1f1-444c-8f58-718958b6724e')
def test_delete_image_non_hex_string_id(self):
# Return an error while trying to delete an image with non hex id
"""Check trying to delete an image with non hex id should fail"""
invalid_image_id = data_utils.rand_uuid()[:-1] + "j"
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
invalid_image_id)
@ -122,13 +132,13 @@ class ImagesDeleteNegativeTestJSON(ImagesNegativeTestBase):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('68e2c175-bd26-4407-ac0f-4ea9ce2139ea')
def test_delete_image_negative_image_id(self):
# Return an error while trying to delete an image with negative id
"""Check trying to delete an image with negative id should fail"""
self.assertRaises(lib_exc.NotFound, self.client.delete_image, -1)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b340030d-82cd-4066-a314-c72fb7c59277')
def test_delete_image_with_id_over_character_limit(self):
# Return an error while trying to delete image with id over limit
"""Check trying to delete image with id over limit should fail"""
invalid_image_id = data_utils.rand_uuid() + "1"
self.assertRaises(lib_exc.NotFound, self.client.delete_image,
invalid_image_id)

View File

@ -21,6 +21,8 @@ CONF = config.CONF
class ListImagesTestJSON(base.BaseV2ComputeTest):
"""Test listing server images with compute microversion less than 2.36"""
max_microversion = '2.35'
@classmethod
@ -37,20 +39,26 @@ class ListImagesTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('490d0898-e12a-463f-aef0-c50156b9f789')
def test_get_image(self):
# Returns the correct details for a single image
"""Test getting the correct details for a single server image"""
image = self.client.show_image(self.image_ref)['image']
self.assertEqual(self.image_ref, image['id'])
@decorators.idempotent_id('fd51b7f4-d4a3-4331-9885-866658112a6f')
def test_list_images(self):
# The list of all images should contain the image
"""Test listing server images
The list of all images should contain the image
"""
images = self.client.list_images()['images']
found = [i for i in images if i['id'] == self.image_ref]
self.assertNotEmpty(found)
@decorators.idempotent_id('9f94cb6b-7f10-48c5-b911-a0b84d7d4cd6')
def test_list_images_with_detail(self):
# Detailed list of all images should contain the expected images
"""Test listing server images with detail
Detailed list of all images should contain the expected images
"""
images = self.client.list_images(detail=True)['images']
found = [i for i in images if i['id'] == self.image_ref]
self.assertNotEmpty(found)

View File

@ -18,6 +18,11 @@ from tempest.lib import decorators
class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
"""Test compute absolute limits
Test compute absolute limits with compute microversion less than 2.57
"""
max_microversion = '2.56'
@classmethod
@ -27,12 +32,17 @@ class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
def test_absLimits_get(self):
"""Test getting nova absolute limits"""
# To check if all limits are present in the response (will be checked
# by schema)
self.client.show_limits()
class AbsoluteLimitsV257TestJSON(base.BaseV2ComputeTest):
"""Test compute absolute limits
Test compute absolute limits with compute microversion greater than 2.56
"""
min_microversion = '2.57'
max_microversion = 'latest'

View File

@ -20,6 +20,7 @@ from tempest.lib import exceptions as lib_exc
class AbsoluteLimitsNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of nova absolute limits"""
def setUp(self):
# NOTE(mriedem): Avoid conflicts with os-quota-class-sets tests.
@ -34,7 +35,10 @@ class AbsoluteLimitsNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('215cd465-d8ae-49c9-bf33-9c911913a5c8')
def test_max_metadata_exceed_limit(self):
# We should not create vm with metadata over maxServerMeta limit
"""Test creating server with metadata over limit should fail
We should not create server with metadata over maxServerMeta limit
"""
# Get max limit value
limits = self.client.show_limits()['limits']
max_meta = limits['absolute']['maxServerMeta']

View File

@ -26,6 +26,7 @@ CONF = config.CONF
class DeleteServersTestJSON(base.BaseV2ComputeTest):
"""Test deleting servers in various states"""
create_default_network = True
# NOTE: Server creations of each test class should be under 10
@ -38,21 +39,21 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('9e6e0c87-3352-42f7-9faf-5d6210dbd159')
def test_delete_server_while_in_building_state(self):
# Delete a server while it's VM state is Building
"""Test deleting a server while it's VM state is Building"""
server = self.create_test_server(wait_until='BUILD')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
@decorators.idempotent_id('925fdfb4-5b13-47ea-ac8a-c36ae6fddb05')
def test_delete_active_server(self):
# Delete a server while it's VM state is Active
"""Test deleting a server while it's VM state is Active"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])
@decorators.idempotent_id('546d368c-bb6c-4645-979a-83ed16f3a6be')
def test_delete_server_while_in_shutoff_state(self):
# Delete a server while it's VM state is Shutoff
"""Test deleting a server while it's VM state is Shutoff"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
@ -63,7 +64,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
def test_delete_server_while_in_pause_state(self):
# Delete a server while it's VM state is Pause
"""Test deleting a server while it's VM state is Pause"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.pause_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
@ -74,7 +75,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
def test_delete_server_while_in_suspended_state(self):
# Delete a server while it's VM state is Suspended
"""Test deleting a server while it's VM state is Suspended"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.suspend_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SUSPENDED')
@ -85,7 +86,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
'Shelve is not available.')
def test_delete_server_while_in_shelved_state(self):
# Delete a server while it's VM state is Shelved
"""Test deleting a server while it's VM state is Shelved"""
server = self.create_test_server(wait_until='ACTIVE')
compute.shelve_server(self.client, server['id'])
@ -96,7 +97,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@testtools.skipIf(not CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_delete_server_while_in_verify_resize_state(self):
# Delete a server while it's VM state is VERIFY_RESIZE
"""Test deleting a server while it's VM state is VERIFY_RESIZE"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.resize_server(server['id'], self.flavor_ref_alt)
waiters.wait_for_server_status(self.client, server['id'],
@ -107,7 +108,7 @@ class DeleteServersTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('d0f3f0d6-d9b6-4a32-8da4-23015dcab23c')
@utils.services('volume')
def test_delete_server_while_in_attached_volume(self):
# Delete a server while a volume is attached to it
"""Test deleting a server while a volume is attached to it"""
server = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()

View File

@ -82,18 +82,18 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('5dc57eda-35b7-4af7-9e5f-3c2be3d2d68b')
def test_create_delete_server_group_with_affinity_policy(self):
# Create and Delete the server-group with affinity policy
"""Test Create/Delete the server-group with affinity policy"""
self._create_delete_server_group(self.policy)
@decorators.idempotent_id('3645a102-372f-4140-afad-13698d850d23')
def test_create_delete_server_group_with_anti_affinity_policy(self):
# Create and Delete the server-group with anti-affinity policy
"""Test Create/Delete the server-group with anti-affinity policy"""
policy = ['anti-affinity']
self._create_delete_server_group(policy)
@decorators.idempotent_id('154dc5a4-a2fe-44b5-b99e-f15806a4a113')
def test_create_delete_multiple_server_groups_with_same_name_policy(self):
# Create and Delete the server-groups with same name and same policy
"""Test Create/Delete the server-groups with same name and policy"""
server_groups = []
server_group_name = data_utils.rand_name('server-group')
for _ in range(0, 2):
@ -108,14 +108,14 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('b3545034-dd78-48f0-bdc2-a4adfa6d0ead')
def test_show_server_group(self):
# Get the server-group
"""Test getting the server-group detail"""
body = self.client.show_server_group(
self.created_server_group['id'])['server_group']
self.assertEqual(self.created_server_group, body)
@decorators.idempotent_id('d4874179-27b4-4d7d-80e4-6c560cdfe321')
def test_list_server_groups(self):
# List the server-group
"""Test listing the server-groups"""
body = self.client.list_server_groups()['server_groups']
self.assertIn(self.created_server_group, body)
@ -124,7 +124,7 @@ class ServerGroupTestJSON(base.BaseV2ComputeTest):
compute.is_scheduler_filter_enabled("ServerGroupAffinityFilter"),
'ServerGroupAffinityFilter is not available.')
def test_create_server_with_scheduler_hint_group(self):
# Create a server with the scheduler hint "group".
"""Test creating a server with the scheduler hint 'group'"""
hints = {'group': self.created_server_group['id']}
server = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')

View File

@ -30,6 +30,8 @@ CONF = config.CONF
class ServersNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of servers"""
create_default_network = True
def setUp(self):
@ -66,8 +68,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('dbbfd247-c40c-449e-8f6c-d2aa7c7da7cf')
def test_server_name_blank(self):
# Create a server with name parameter empty
"""Creating a server with name parameter empty should fail"""
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
name='')
@ -77,8 +78,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.personality,
'Nova personality feature disabled')
def test_personality_file_contents_not_encoded(self):
# Use an unencoded file when creating a server with personality
"""Using an unencoded injected file to create server should fail"""
file_contents = 'This is a test file.'
person = [{'path': '/etc/testfile.txt',
'contents': file_contents}]
@ -90,8 +90,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('fcba1052-0a50-4cf3-b1ac-fae241edf02f')
def test_create_with_invalid_image(self):
# Create a server with an unknown image
"""Creating a server with an unknown image should fail"""
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
image_id=-1)
@ -99,8 +98,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('18f5227f-d155-4429-807c-ccb103887537')
def test_create_with_invalid_flavor(self):
# Create a server with an unknown flavor
"""Creating a server with an unknown flavor should fail"""
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
flavor=-1,)
@ -108,8 +106,10 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7f70a4d1-608f-4794-9e56-cb182765972c')
def test_invalid_access_ip_v4_address(self):
# An access IPv4 address must match a valid address pattern
"""Creating a server with invalid ipv4 ip address should fail
An access IPv4 address must match a valid address pattern
"""
IPv4 = '1.1.1.1.1.1'
self.assertRaises(lib_exc.BadRequest,
self.create_test_server, accessIPv4=IPv4)
@ -117,8 +117,10 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5226dd80-1e9c-4d8a-b5f9-b26ca4763fd0')
def test_invalid_ip_v6_address(self):
# An access IPv6 address must match a valid address pattern
"""Creating a server with invalid ipv6 ip address should fail
An access IPv6 address must match a valid address pattern
"""
IPv6 = 'notvalid'
self.assertRaises(lib_exc.BadRequest,
@ -129,7 +131,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_nonexistent_server(self):
# Resize a non-existent server
"""Resizing a non-existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.resize_server,
@ -140,7 +142,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_with_non_existent_flavor(self):
# Resize a server with non-existent flavor
"""Resizing a server with non existent flavor should fail"""
nonexistent_flavor = data_utils.rand_uuid()
self.assertRaises(lib_exc.BadRequest, self.client.resize_server,
self.server_id, flavor_ref=nonexistent_flavor)
@ -150,14 +152,14 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Resize not available.')
@decorators.attr(type=['negative'])
def test_resize_server_with_null_flavor(self):
# Resize a server with null flavor
"""Resizing a server with null flavor should fail"""
self.assertRaises(lib_exc.BadRequest, self.client.resize_server,
self.server_id, flavor_ref="")
@decorators.attr(type=['negative'])
@decorators.idempotent_id('d4c023a0-9c55-4747-9dd5-413b820143c7')
def test_reboot_non_existent_server(self):
# Reboot a non existent server
"""Rebooting a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
nonexistent_server, type='SOFT')
@ -167,7 +169,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Pause is not available.')
@decorators.attr(type=['negative'])
def test_pause_paused_server(self):
# Pause a paused server.
"""Pausing a paused server should fail"""
self.client.pause_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id, 'PAUSED')
self.assertRaises(lib_exc.Conflict,
@ -178,7 +180,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('98fa0458-1485-440f-873b-fe7f0d714930')
def test_rebuild_deleted_server(self):
# Rebuild a deleted server
"""Rebuilding a deleted server should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.rebuild_server,
self.deleted_server_id, self.image_ref)
@ -187,14 +189,14 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('581a397d-5eab-486f-9cf9-1014bbd4c984')
def test_reboot_deleted_server(self):
# Reboot a deleted server
"""Rebooting a deleted server should fail"""
self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
self.deleted_server_id, type='SOFT')
@decorators.attr(type=['negative'])
@decorators.idempotent_id('d86141a7-906e-4731-b187-d64a2ea61422')
def test_rebuild_non_existent_server(self):
# Rebuild a non existent server
"""Rebuilding a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.rebuild_server,
@ -204,6 +206,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('fd57f159-68d6-4c2a-902b-03070828a87e')
def test_create_numeric_server_name(self):
"""Creating a server with numeric server name should fail"""
server_name = 12345
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
@ -212,8 +215,11 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c3e0fb12-07fc-4d76-a22e-37409887afe8')
def test_create_server_name_length_exceeds_256(self):
# Create a server with name length exceeding 255 characters
"""Creating a server with name length exceeding limit should fail
Create a server with name length exceeding 255 characters, an error is
returned.
"""
server_name = 'a' * 256
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
@ -224,6 +230,11 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@utils.services('volume')
@decorators.idempotent_id('12146ac1-d7df-4928-ad25-b1f99e5286cd')
def test_create_server_invalid_bdm_in_2nd_dict(self):
"""Creating a server with invalid block_device_mapping_v2 should fail
Create a server with invalid block_device_mapping_v2, an error is
returned.
"""
volume = self.create_volume()
bdm_1st = {"source_type": "image",
"delete_on_termination": True,
@ -243,10 +254,9 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4e72dc2d-44c5-4336-9667-f7972e95c402')
def test_create_with_invalid_network_uuid(self):
"""Creating a server with invalid network uuid should fail"""
# Pass invalid network uuid while creating a server
networks = [{'fixed_ip': '10.0.1.1', 'uuid': 'a-b-c-d-e-f-g-h-i-j'}]
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
networks=networks)
@ -254,8 +264,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7a2efc39-530c-47de-b875-2dd01c8d39bd')
def test_create_with_non_existent_keypair(self):
"""Creating a server with non-existent keypair should fail"""
# Pass a non-existent keypair while creating a server
key_name = data_utils.rand_name('key')
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
@ -264,8 +274,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7fc74810-0bd2-4cd7-8244-4f33a9db865a')
def test_create_server_metadata_exceeds_length_limit(self):
"""Creating a server with metadata longer than limit should fail """
# Pass really long metadata while creating a server
metadata = {'a': 'b' * 260}
self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
@ -274,8 +284,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('aa8eed43-e2cb-4ebf-930b-da14f6a21d81')
def test_update_name_of_non_existent_server(self):
# Update name of a non-existent server
"""Updating name of a non-existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
new_name = data_utils.rand_name(
self.__class__.__name__ + '-server') + '_updated'
@ -286,18 +295,19 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('38204696-17c6-44da-9590-40f87fb5a899')
def test_update_server_set_empty_name(self):
# Update name of the server to an empty string
"""Updating name of the server to an empty string should fail"""
new_name = ''
self.assertRaises(lib_exc.BadRequest, self.client.update_server,
self.server_id, name=new_name)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5c8e244c-dada-4590-9944-749c455b431f')
def test_update_server_name_length_exceeds_256(self):
# Update name of server exceed the name length limit
"""Updating name of server exceeding the name length limit should fail
Update name of server exceeding the name length limit, an error is
returned.
"""
new_name = 'a' * 256
self.assertRaises(lib_exc.BadRequest,
self.client.update_server,
@ -307,8 +317,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('1041b4e6-514b-4855-96a5-e974b60870a3')
def test_delete_non_existent_server(self):
# Delete a non existent server
"""Deleting a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.delete_server,
nonexistent_server)
@ -316,23 +325,24 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('75f79124-277c-45e6-a373-a1d6803f4cc4')
def test_delete_server_pass_negative_id(self):
# Pass an invalid string parameter to delete server
"""Passing an invalid string parameter to delete server should fail"""
self.assertRaises(lib_exc.NotFound, self.client.delete_server, -1)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('f4d7279b-5fd2-4bf2-9ba4-ae35df0d18c5')
def test_delete_server_pass_id_exceeding_length_limit(self):
# Pass a server ID that exceeds length limit to delete server
"""Deleting server with a server ID exceeding length limit should fail
Pass a server ID that exceeds length limit to delete server, an error
is returned.
"""
self.assertRaises(lib_exc.NotFound, self.client.delete_server,
sys.maxsize + 1)
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c5fa6041-80cd-483b-aa6d-4e45f19d093c')
def test_create_with_nonexistent_security_group(self):
# Create a server with a nonexistent security group
"""Creating a server with a nonexistent security group should fail"""
security_groups = [{'name': 'does_not_exist'}]
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
@ -341,7 +351,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('3436b02f-1b1e-4f03-881e-c6a602327439')
def test_get_non_existent_server(self):
# Get a non existent server details
"""Getting a non existent server details should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.show_server,
nonexistent_server)
@ -349,7 +359,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('a31460a9-49e1-42aa-82ee-06e0bb7c2d03')
def test_stop_non_existent_server(self):
# Stop a non existent server
"""Stopping a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.servers_client.stop_server,
nonexistent_server)
@ -359,7 +369,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Pause is not available.')
@decorators.attr(type=['negative'])
def test_pause_non_existent_server(self):
# pause a non existent server
"""Pausing a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.pause_server,
nonexistent_server)
@ -369,7 +379,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Pause is not available.')
@decorators.attr(type=['negative'])
def test_unpause_non_existent_server(self):
# unpause a non existent server
"""Unpausing a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.unpause_server,
nonexistent_server)
@ -379,7 +389,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Pause is not available.')
@decorators.attr(type=['negative'])
def test_unpause_server_invalid_state(self):
# unpause an active server.
"""Unpausing an active server should fail"""
self.assertRaises(lib_exc.Conflict,
self.client.unpause_server,
self.server_id)
@ -389,7 +399,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_suspend_non_existent_server(self):
# suspend a non existent server
"""Suspending a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.suspend_server,
nonexistent_server)
@ -399,7 +409,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_suspend_server_invalid_state(self):
# suspend a suspended server.
"""Suspending a suspended server should fail"""
self.client.suspend_server(self.server_id)
waiters.wait_for_server_status(self.client, self.server_id,
'SUSPENDED')
@ -413,7 +423,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_resume_non_existent_server(self):
# resume a non existent server
"""Resuming a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.resume_server,
nonexistent_server)
@ -423,7 +433,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Suspend is not available.')
@decorators.attr(type=['negative'])
def test_resume_server_invalid_state(self):
# resume an active server.
"""Resuming an active server should fail"""
self.assertRaises(lib_exc.Conflict,
self.client.resume_server,
self.server_id)
@ -431,7 +441,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7dd919e7-413f-4198-bebb-35e2a01b13e9')
def test_get_console_output_of_non_existent_server(self):
# get the console output for a non existent server
"""Getting the console output for a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.get_console_output,
@ -440,7 +450,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6f47992b-5144-4250-9f8b-f00aa33950f3')
def test_force_delete_nonexistent_server_id(self):
# force-delete a non existent server
"""Force-deleting a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.force_delete_server,
@ -449,7 +459,11 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('9c6d38cc-fcfb-437a-85b9-7b788af8bf01')
def test_restore_nonexistent_server_id(self):
# restore-delete a non existent server
"""Restore-deleting a non existent server should fail
We can restore a soft deleted server, but can't restore a non
existent server.
"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.restore_soft_deleted_server,
@ -458,7 +472,11 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7fcadfab-bd6a-4753-8db7-4a51e51aade9')
def test_restore_server_invalid_state(self):
# we can only restore-delete a server in 'soft-delete' state
"""Restore-deleting a server not in 'soft-delete' state should fail
We can restore a soft deleted server, but can't restore a server that
is not in 'soft-delete' state.
"""
self.assertRaises(lib_exc.Conflict,
self.client.restore_soft_deleted_server,
self.server_id)
@ -468,7 +486,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Shelve is not available.')
@decorators.attr(type=['negative'])
def test_shelve_non_existent_server(self):
# shelve a non existent server
"""Shelving a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.shelve_server,
nonexistent_server)
@ -478,7 +496,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Shelve is not available.')
@decorators.attr(type=['negative'])
def test_shelve_shelved_server(self):
# shelve a shelved server.
"""Shelving a shelved server should fail"""
compute.shelve_server(self.client, self.server_id)
def _unshelve_server():
@ -508,7 +526,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Shelve is not available.')
@decorators.attr(type=['negative'])
def test_unshelve_non_existent_server(self):
# unshelve a non existent server
"""Unshelving a non existent server should fail"""
nonexistent_server = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound, self.client.unshelve_server,
nonexistent_server)
@ -518,7 +536,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
'Shelve is not available.')
@decorators.attr(type=['negative'])
def test_unshelve_server_invalid_state(self):
# unshelve an active server.
"""Unshelving an active server should fail"""
self.assertRaises(lib_exc.Conflict,
self.client.unshelve_server,
self.server_id)
@ -527,7 +545,7 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('74085be3-a370-4ca2-bc51-2d0e10e0f573')
@utils.services('volume', 'image')
def test_create_server_from_non_bootable_volume(self):
# Create a volume
"""Creating a server from a non bootable volume should fail"""
volume = self.create_volume()
# Update volume bootable status to false
@ -555,6 +573,8 @@ class ServersNegativeTestJSON(base.BaseV2ComputeTest):
class ServersNegativeTestMultiTenantJSON(base.BaseV2ComputeTest):
"""Negative tests of servers for multiple projects"""
create_default_network = True
credentials = ['primary', 'alt']
@ -581,8 +601,11 @@ class ServersNegativeTestMultiTenantJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('543d84c1-dd2e-4c6d-8cb2-b9da0efaa384')
def test_update_server_of_another_tenant(self):
# Update name of a server that belongs to another tenant
"""Updating server that belongs to another project should fail
Update name of a server that belongs to another project, an error is
returned.
"""
new_name = self.server_id + '_new'
self.assertRaises(lib_exc.NotFound,
self.alt_client.update_server, self.server_id,
@ -591,7 +614,7 @@ class ServersNegativeTestMultiTenantJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('5c75009d-3eea-423e-bea3-61b09fd25f9c')
def test_delete_a_server_of_another_tenant(self):
# Delete a server that belongs to another tenant
"""Deleting a server that belongs to another project should fail"""
self.assertRaises(lib_exc.NotFound,
self.alt_client.delete_server,
self.server_id)

View File

@ -59,13 +59,17 @@ class BaseAttachVolumeTest(base.BaseV2ComputeTest):
class AttachVolumeTestJSON(BaseAttachVolumeTest):
"""Test attaching volume to server"""
@decorators.idempotent_id('52e9045a-e90d-4c0d-9087-79d657faffff')
# This test is conditionally marked slow if SSH validation is enabled.
@decorators.attr(type='slow', condition=CONF.validation.run_validation)
def test_attach_detach_volume(self):
# Stop and Start a server with an attached volume, ensuring that
# the volume remains attached.
"""Test attaching and detaching volume from server
Stop and Start a server with an attached volume, ensuring that
the volume remains attached.
"""
server, validation_resources = self._create_server()
# NOTE(andreaf) Create one remote client used throughout the test.
@ -125,6 +129,13 @@ class AttachVolumeTestJSON(BaseAttachVolumeTest):
@decorators.idempotent_id('7fa563fe-f0f7-43eb-9e22-a1ece036b513')
def test_list_get_volume_attachments(self):
"""Test listing and getting volume attachments
First we attach one volume to the server, check listing and getting
the volume attachment of the server. Then we attach another volume to
the server, check listing and getting the volume attachments of the
server. Finally we detach the volumes from the server one by one.
"""
# List volume attachment of the server
server, validation_resources = self._create_server()
volume_1st = self.create_volume()
@ -244,8 +255,12 @@ class AttachVolumeShelveTestJSON(BaseAttachVolumeTest):
@decorators.attr(type='slow')
@decorators.idempotent_id('13a940b6-3474-4c3c-b03f-29b89112bfee')
def test_attach_volume_shelved_or_offload_server(self):
# Create server, count number of volumes on it, shelve
# server and attach pre-created volume to shelved server
"""Test attaching volume to shelved server
Create server, count number of volumes on it, shelve
server and attach pre-created volume to shelved server, then
unshelve the server and check that attached volume exists.
"""
server, validation_resources = self._create_server()
volume = self.create_volume()
num_vol = self._count_volumes(server, validation_resources)
@ -271,8 +286,12 @@ class AttachVolumeShelveTestJSON(BaseAttachVolumeTest):
@decorators.attr(type='slow')
@decorators.idempotent_id('b54e86dd-a070-49c4-9c07-59ae6dae15aa')
def test_detach_volume_shelved_or_offload_server(self):
# Count number of volumes on instance, shelve
# server and attach pre-created volume to shelved server
"""Test detaching volume from shelved server
Count number of volumes on server, shelve server and attach
pre-created volume to shelved server, then detach the volume, unshelve
the instance and check that we have the expected number of volume(s).
"""
server, validation_resources = self._create_server()
volume = self.create_volume()
num_vol = self._count_volumes(server, validation_resources)
@ -291,6 +310,12 @@ class AttachVolumeShelveTestJSON(BaseAttachVolumeTest):
class AttachVolumeMultiAttachTest(BaseAttachVolumeTest):
"""Test attaching one volume to multiple servers
Test attaching one volume to multiple servers with compute
microversion greater than 2.59.
"""
min_microversion = '2.60'
max_microversion = 'latest'
@ -367,6 +392,12 @@ class AttachVolumeMultiAttachTest(BaseAttachVolumeTest):
@decorators.idempotent_id('8d5853f7-56e7-4988-9b0c-48cea3c7049a')
def test_list_get_volume_attachments_multiattach(self):
"""Test listing and getting multiattached volume attachments
Attach a single volume to two servers, list attachments from the
volume and make sure the server uuids are in the list, then detach
the volume from servers one by one.
"""
# Attach a single volume to two servers.
servers, volume, attachments = self._create_and_multiattach()
@ -448,7 +479,10 @@ class AttachVolumeMultiAttachTest(BaseAttachVolumeTest):
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
'Resize not available.')
def test_resize_server_with_multiattached_volume(self):
# Attach a single volume to multiple servers, then resize the servers
"""Test resizing servers with multiattached volume
Attach a single volume to multiple servers, then resize the servers
"""
servers, volume, _ = self._create_and_multiattach()
for server in servers:

View File

@ -26,11 +26,14 @@ from tempest.lib import decorators
class VolumesListTestJSON(base.BaseVolumeTest):
# NOTE: This test creates a number of 1G volumes. To run it successfully,
# ensure that the backing file for the volume group that Cinder uses
# has space for at least 3 1G volumes!
# If you are running a Devstack environment, ensure that the
# VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
"""Test listing volumes
NOTE: This test creates a number of 1G volumes. To run it successfully,
ensure that the backing file for the volume group that Cinder uses
has space for at least 3 1G volumes!
If you are running a Devstack environment, ensure that the
VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
"""
VOLUME_FIELDS = ('id', 'name')
@ -116,7 +119,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('0b6ddd39-b948-471f-8038-4787978747c4')
def test_volume_list(self):
# Get a list of Volumes
"""Test getting a list of volumes"""
# Fetch all volumes
fetched_list = self.volumes_client.list_volumes()['volumes']
self._assert_volumes_in(fetched_list, self.volume_list,
@ -124,13 +127,14 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('adcbb5a7-5ad8-4b61-bd10-5380e111a877')
def test_volume_list_with_details(self):
# Get a list of Volumes with details
"""Test getting a list of detailed volumes"""
# Fetch all Volumes
fetched_list = self.volumes_client.list_volumes(detail=True)['volumes']
self._assert_volumes_in(fetched_list, self.volume_list)
@decorators.idempotent_id('a28e8da4-0b56-472f-87a8-0f4d3f819c02')
def test_volume_list_by_name(self):
"""Test getting a list of volumes filtered by volume name"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name']}
fetched_vol = self.volumes_client.list_volumes(
@ -140,6 +144,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('2de3a6d4-12aa-403b-a8f2-fdeb42a89623')
def test_volume_list_details_by_name(self):
"""Test getting a list of detailed volumes filtered by volume name"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name']}
fetched_vol = self.volumes_client.list_volumes(
@ -149,6 +154,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('39654e13-734c-4dab-95ce-7613bf8407ce')
def test_volumes_list_by_status(self):
"""Test getting a list of volumes filtered by volume status"""
params = {'status': 'available'}
fetched_list = self.volumes_client.list_volumes(
params=params)['volumes']
@ -158,6 +164,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('2943f712-71ec-482a-bf49-d5ca06216b9f')
def test_volumes_list_details_by_status(self):
"""Test getting a list of detailed volumes filtered by status"""
params = {'status': 'available'}
fetched_list = self.volumes_client.list_volumes(
detail=True, params=params)['volumes']
@ -181,6 +188,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('2016a939-72ec-482a-bf49-d5ca06216b9f')
def test_volumes_list_details_by_bootable(self):
"""Test getting a list of detailed volumes filtered by bootable"""
params = {'bootable': 'false'}
fetched_list = self.volumes_client.list_volumes(
detail=True, params=params)['volumes']
@ -190,6 +198,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('c0cfa863-3020-40d7-b587-e35f597d5d87')
def test_volumes_list_by_availability_zone(self):
"""Test getting a list of volumes filtered by availability zone"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
@ -201,6 +210,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('e1b80d13-94f0-4ba2-a40e-386af29f8db1')
def test_volumes_list_details_by_availability_zone(self):
"""Test getting a list of detailed volumes by availability zone"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
zone = volume['availability_zone']
params = {'availability_zone': zone}
@ -212,19 +222,19 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('b5ebea1b-0603-40a0-bb41-15fcd0a53214')
def test_volume_list_with_param_metadata(self):
# Test to list volumes when metadata param is given
"""Test listing volumes when metadata param is given"""
params = {'metadata': self.metadata}
self._list_by_param_value_and_assert(params)
@decorators.idempotent_id('1ca92d3c-4a8e-4b43-93f5-e4c7fb3b291d')
def test_volume_list_with_detail_param_metadata(self):
# Test to list volumes details when metadata param is given
"""Test listing volumes details when metadata param is given"""
params = {'metadata': self.metadata}
self._list_by_param_value_and_assert(params, with_detail=True)
@decorators.idempotent_id('777c87c1-2fc4-4883-8b8e-5c0b951d1ec8')
def test_volume_list_param_display_name_and_status(self):
# Test to list volume when display name and status param is given
"""Test listing volume when display name and status param is given"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name'],
'status': 'available'}
@ -232,7 +242,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('856ab8ca-6009-4c37-b691-be1065528ad4')
def test_volume_list_with_detail_param_display_name_and_status(self):
# Test to list volume when name and status param is given
"""Test listing volume when name and status param is given"""
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
params = {'name': volume['name'],
'status': 'available'}
@ -240,7 +250,7 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('2a7064eb-b9c3-429b-b888-33928fc5edd3')
def test_volume_list_details_with_multiple_params(self):
# List volumes detail using combined condition
"""Test listing volumes detail using combined filtering condition"""
def _list_details_with_multiple_params(limit=2,
status='available',
sort_dir='asc',
@ -375,14 +385,29 @@ class VolumesListTestJSON(base.BaseVolumeTest):
@decorators.idempotent_id('e9138a2c-f67b-4796-8efa-635c196d01de')
def test_volume_list_details_pagination(self):
"""Test listing volumes with details by pagination
All volumes will be returned by multiple requests, and the number of
'limit' volumes will be returned at a time.
"""
self._test_pagination('volumes', ids=self.volume_id_list, detail=True)
@decorators.idempotent_id('af55e775-8e4b-4feb-8719-215c43b0238c')
def test_volume_list_pagination(self):
"""Test listing volumes by pagination
All volumes will be returned by multiple requests, and the number of
'limit' volumes will be returned at a time.
"""
self._test_pagination('volumes', ids=self.volume_id_list, detail=False)
@decorators.idempotent_id('46eff077-100b-427f-914e-3db2abcdb7e2')
def test_volume_list_with_detail_param_marker(self):
"""Test listing volumes with details from the specified marker
Choose a volume id from all volumes as a marker, list volumes with
that marker, only volumes with id greater than marker will be returned.
"""
# Choosing a random volume from a list of volumes for 'marker'
# parameter
marker = random.choice(self.volume_id_list)