Merge "Adding description for testcases - compute part12"

This commit is contained in:
Zuul 2020-09-06 11:11:03 +00:00 committed by Gerrit Code Review
commit 6b46098b0b
9 changed files with 110 additions and 29 deletions

View File

@ -25,6 +25,7 @@ CONF = config.CONF
class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
"""Test floating ips API with compute microversion less than 2.36"""
max_microversion = '2.35'
@ -46,8 +47,7 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('6e0f059b-e4dd-48fb-8207-06e3bba5b074')
def test_allocate_floating_ip_from_nonexistent_pool(self):
# Negative test:Allocation of a new floating IP from a nonexistent_pool
# to a project should fail
"""Test allocating floating ip from non existent pool should fail"""
self.assertRaises(lib_exc.NotFound,
self.client.create_floating_ip,
pool="non_exist_pool")
@ -55,15 +55,14 @@ class FloatingIPsNegativeTestJSON(base.BaseFloatingIPsTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ae1c55a8-552b-44d4-bfb6-2a115a15d0ba')
def test_delete_nonexistent_floating_ip(self):
# Negative test:Deletion of a nonexistent floating IP
# from project should fail
"""Test deleting non existent floating ip should fail"""
# Deleting the non existent floating IP
self.assertRaises(lib_exc.NotFound, self.client.delete_floating_ip,
self.non_exist_id)
class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
"""Test floating ips API with compute microversion less than 2.44"""
max_microversion = '2.43'
@ -76,8 +75,7 @@ class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('595fa616-1a71-4670-9614-46564ac49a4c')
def test_associate_nonexistent_floating_ip(self):
# Negative test:Association of a non existent floating IP
# to specific server should fail
"""Test associating non existent floating ip to server should fail"""
# Associating non existent floating IP
self.assertRaises(lib_exc.NotFound,
self.client.associate_floating_ip_to_server,
@ -86,7 +84,7 @@ class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0a081a66-e568-4e6b-aa62-9587a876dca8')
def test_dissociate_nonexistent_floating_ip(self):
# Negative test:Dissociation of a non existent floating IP should fail
"""Test dissociating non existent floating ip should fail"""
# Dissociating non existent floating IP
self.assertRaises(lib_exc.NotFound,
self.client.disassociate_floating_ip_from_server,
@ -95,7 +93,7 @@ class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('804b4fcb-bbf5-412f-925d-896672b61eb3')
def test_associate_ip_to_server_without_passing_floating_ip(self):
# Negative test:Association of empty floating IP to specific server
"""Test associating empty floating ip to server should fail"""
# should raise NotFound or BadRequest(In case of Nova V2.1) exception.
self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
self.client.associate_floating_ip_to_server,
@ -106,10 +104,13 @@ class FloatingIPsAssociationNegativeTestJSON(base.BaseFloatingIPsTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_associate_ip_to_server_with_floating_ip(self):
# The VM have one port
# Associate floating IP A to the VM
# Associate floating IP B which is from same pool with floating IP A
# to the VM, should raise BadRequest exception
"""Test associating floating ip to server already with floating ip
1. The VM have one port
2. Associate floating IP A to the VM
3. Associate floating IP B which is from same pool with floating IP A
to the VM, should raise BadRequest exception
"""
body = self.client.create_floating_ip(
pool=CONF.network.public_network_id)['floating_ip']
self.addCleanup(self.client.delete_floating_ip, body['id'])

View File

@ -21,6 +21,7 @@ CONF = config.CONF
class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
"""Test floating ip details with compute microversion less than 2.36"""
max_microversion = '2.35'
@ -37,7 +38,7 @@ class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
@decorators.idempotent_id('16db31c3-fb85-40c9-bbe2-8cf7b67ff99f')
def test_list_floating_ips(self):
# Positive test:Should return the list of floating IPs
"""Test listing floating ips"""
body = self.client.list_floating_ips()['floating_ips']
floating_ips = body
self.assertNotEmpty(floating_ips,
@ -47,7 +48,7 @@ class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
@decorators.idempotent_id('eef497e0-8ff7-43c8-85ef-558440574f84')
def test_get_floating_ip_details(self):
# Positive test:Should be able to GET the details of floatingIP
"""Test getting floating ip details"""
# Creating a floating IP for which details are to be checked
body = self.client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
@ -68,7 +69,7 @@ class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
@decorators.idempotent_id('df389fc8-56f5-43cc-b290-20eda39854d3')
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
"""Test listing floating ip pools"""
floating_ip_pools = self.pools_client.list_floating_ip_pools()
self.assertNotEmpty(floating_ip_pools['floating_ip_pools'],
"Expected floating IP Pools. Got zero.")

View File

@ -23,14 +23,18 @@ CONF = config.CONF
class FloatingIPDetailsNegativeTestJSON(base.BaseFloatingIPsTest):
"""Negative tests of floating ip detail
Negative tests of floating ip detail with compute microversion less
than 2.36.
"""
max_microversion = '2.35'
@decorators.attr(type=['negative'])
@decorators.idempotent_id('7ab18834-4a4b-4f28-a2c5-440579866695')
def test_get_nonexistent_floating_ip_details(self):
# Negative test:Should not be able to GET the details
# of non-existent floating IP
"""Test getting non existent floating ip should fail"""
# Creating a non-existent floatingIP id
if CONF.service_available.neutron:
non_exist_id = data_utils.rand_uuid()

View File

@ -99,6 +99,7 @@ class AttachInterfacesTestBase(base.BaseV2ComputeTest):
class AttachInterfacesTestJSON(AttachInterfacesTestBase):
"""Test attaching interfaces"""
def wait_for_port_detach(self, port_id):
"""Waits for the port's device_id to be unset.
@ -230,6 +231,7 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
@decorators.idempotent_id('73fe8f02-590d-4bf1-b184-e9ca81065051')
@utils.services('network')
def test_create_list_show_delete_interfaces_by_network_port(self):
"""Test create/list/show/delete interfaces by network port"""
server, ifs, _ = self._create_server_get_interfaces()
interface_count = len(ifs)
self.assertGreater(interface_count, 0)
@ -262,6 +264,7 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
@decorators.idempotent_id('d290c06c-f5b3-11e7-8ec8-002293781009')
@utils.services('network')
def test_create_list_show_delete_interfaces_by_fixed_ip(self):
"""Test create/list/show/delete interfaces by fixed ip"""
# NOTE(zhufl) By default only project that is admin or network owner
# or project with role advsvc is authorised to create interfaces with
# fixed-ip, so if we don't create network for each project, do not
@ -290,7 +293,7 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
@decorators.idempotent_id('2f3a0127-95c7-4977-92d2-bc5aec602fb4')
def test_reassign_port_between_servers(self):
"""Tests the following:
"""Tests reassigning port between servers
1. Create a port in Neutron.
2. Create two servers in Nova.
@ -343,12 +346,15 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
class AttachInterfacesUnderV243Test(AttachInterfacesTestBase):
"""Test attaching interfaces with compute microversion less than 2.44"""
max_microversion = '2.43'
@decorators.attr(type='smoke')
@decorators.idempotent_id('c7e0e60b-ee45-43d0-abeb-8596fd42a2f9')
@utils.services('network')
def test_add_remove_fixed_ip(self):
"""Test adding and removing fixed ip from server"""
# NOTE(zhufl) By default only project that is admin or network owner
# or project with role advsvc is authorised to add interfaces with
# fixed-ip, so if we don't create network for each project, do not

View File

@ -103,6 +103,7 @@ class DeviceTaggingBase(base.BaseV2ComputeTest):
class TaggedBootDevicesTest(DeviceTaggingBase):
"""Test tagged boot device with compute microversion equals 2.32"""
min_microversion = '2.32'
# NOTE(mriedem): max_version looks odd but it's actually correct. Due to a
@ -149,6 +150,16 @@ class TaggedBootDevicesTest(DeviceTaggingBase):
@decorators.idempotent_id('a2e65a6c-66f1-4442-aaa8-498c31778d96')
@utils.services('network', 'volume', 'image')
def test_tagged_boot_devices(self):
"""Test tagged boot devices
1. Create volumes
2. Create networks
3. Create subnets
4. Create ports
5. Create server, specifying tags for items in networks and
block_device_mapping_v2,
6. Verify tagged devices are in server via metadata service
"""
# Create volumes
# The create_volume methods waits for the volumes to be available and
# the base class will clean them up on tearDown.
@ -300,11 +311,14 @@ class TaggedBootDevicesTest(DeviceTaggingBase):
class TaggedBootDevicesTest_v242(TaggedBootDevicesTest):
"""Test tagged boot devices with compute microversion greater than 2.41"""
min_microversion = '2.42'
max_microversion = 'latest'
class TaggedAttachmentsTest(DeviceTaggingBase):
"""Test tagged attachments with compute microversion greater than 2.48"""
min_microversion = '2.49'
max_microversion = 'latest'
@ -342,6 +356,16 @@ class TaggedAttachmentsTest(DeviceTaggingBase):
@decorators.idempotent_id('3e41c782-2a89-4922-a9d2-9a188c4e7c7c')
@utils.services('network', 'volume', 'image')
def test_tagged_attachment(self):
"""Test tagged attachment
1. Create network
2. Create subnet
3. Create volume
4. Create server
5. Attach tagged networks and volume
6. Verify tagged devices are in server via metadata service
7. Detach tagged networks and volume
"""
# Create network
net = self.networks_client.create_network(
name=data_utils.rand_name(

View File

@ -19,6 +19,8 @@ from tempest.lib import decorators
class InstanceActionsTestJSON(base.BaseV2ComputeTest):
"""Test instance actions API"""
create_default_network = True
@classmethod
@ -34,7 +36,7 @@ class InstanceActionsTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
# List actions of the provided server
"""Test listing actions of the provided server"""
self.client.reboot_server(self.server['id'], type='HARD')
waiters.wait_for_server_status(self.client,
self.server['id'], 'ACTIVE')
@ -47,7 +49,7 @@ class InstanceActionsTestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('aacc71ca-1d70-4aa5-bbf6-0ff71470e43c')
def test_get_instance_action(self):
# Get the action details of the provided server
"""Test getting the action details of the provided server"""
body = self.client.show_instance_action(
self.server['id'], self.request_id)['instanceAction']
self.assertEqual(self.server['id'], body['instance_uuid'])
@ -55,6 +57,8 @@ class InstanceActionsTestJSON(base.BaseV2ComputeTest):
class InstanceActionsV221TestJSON(base.BaseV2ComputeTest):
"""Test instance actions with compute microversion greater than 2.20"""
create_default_network = True
min_microversion = '2.21'
@ -67,8 +71,11 @@ class InstanceActionsV221TestJSON(base.BaseV2ComputeTest):
@decorators.idempotent_id('0a0f85d4-10fa-41f6-bf80-a54fb4aa2ae1')
def test_get_list_deleted_instance_actions(self):
"""Test listing actions for deleted instance
# List actions of the deleted server
Listing actions for deleted instance should succeed and the returned
actions should contain 'create' and 'delete'.
"""
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
waiters.wait_for_server_termination(self.client, server['id'])

View File

@ -20,6 +20,8 @@ from tempest.lib import exceptions as lib_exc
class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
"""Negative tests of instance actions"""
create_default_network = True
@classmethod
@ -35,7 +37,7 @@ class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('67e1fce6-7ec2-45c6-92d4-0a8f1a632910')
def test_list_instance_actions_non_existent_server(self):
# List actions of the non-existent server id
"""Test listing actions for non existent instance should fail"""
non_existent_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
self.client.list_instance_actions,
@ -44,6 +46,6 @@ class InstanceActionsNegativeTestJSON(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0269f40a-6f18-456c-b336-c03623c897f1')
def test_get_instance_action_invalid_request(self):
# Get the action details of the provided server with invalid request
"""Test getting instance action with invalid request_id should fail"""
self.assertRaises(lib_exc.NotFound, self.client.show_instance_action,
self.server['id'], '999')

View File

@ -53,9 +53,11 @@ class ServerRescueTestBase(base.BaseV2ComputeTest):
class ServerRescueTestJSON(ServerRescueTestBase):
"""Test server rescue"""
@decorators.idempotent_id('fd032140-714c-42e4-a8fd-adcd8df06be6')
def test_rescue_unrescue_instance(self):
"""Test rescue/unrescue server"""
password = data_utils.rand_password()
server = self.create_test_server(adminPass=password,
wait_until='ACTIVE')
@ -68,6 +70,7 @@ class ServerRescueTestJSON(ServerRescueTestBase):
class ServerRescueTestJSONUnderV235(ServerRescueTestBase):
"""Test server rescue with compute microversion less than 2.36"""
max_microversion = '2.35'
@ -81,7 +84,7 @@ class ServerRescueTestJSONUnderV235(ServerRescueTestBase):
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
"Floating ips are not available")
def test_rescued_vm_associate_dissociate_floating_ip(self):
# Association of floating IP to a rescued vm
"""Test associate/dissociate floating ip for rescued server"""
floating_ip_body = self.floating_ips_client.create_floating_ip(
pool=CONF.network.floating_network_name)['floating_ip']
self.addCleanup(self.floating_ips_client.delete_floating_ip,
@ -96,6 +99,7 @@ class ServerRescueTestJSONUnderV235(ServerRescueTestBase):
@decorators.idempotent_id('affca41f-7195-492d-8065-e09eee245404')
def test_rescued_vm_add_remove_security_group(self):
"""Test add/remove security group to for rescued server"""
# Add Security group
sg = self.create_security_group()
self.servers_client.add_security_group(self.rescued_server_id,
@ -154,33 +158,43 @@ class BaseServerStableDeviceRescueTest(base.BaseV2ComputeTest):
class ServerStableDeviceRescueTest(BaseServerStableDeviceRescueTest):
"""Test rescuing server specifying type of device for the rescue disk"""
@decorators.idempotent_id('947004c3-e8ef-47d9-9f00-97b74f9eaf96')
def test_stable_device_rescue_cdrom_ide(self):
"""Test rescuing server with cdrom and ide as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='cdrom', hw_rescue_bus='ide')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('16865750-1417-4854-bcf7-496e6753c01e')
def test_stable_device_rescue_disk_virtio(self):
"""Test rescuing server with disk and virtio as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='virtio')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('12340157-6306-4745-bdda-cfa019908b48')
def test_stable_device_rescue_disk_scsi(self):
"""Test rescuing server with disk and scsi as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='scsi')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('647d04cf-ad35-4956-89ab-b05c5c16f30c')
def test_stable_device_rescue_disk_usb(self):
"""Test rescuing server with disk and usb as the rescue disk"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='usb')
self._test_stable_device_rescue(server_id, rescue_image_id)
@decorators.idempotent_id('a3772b42-00bf-4310-a90b-1cc6fd3e7eab')
def test_stable_device_rescue_disk_virtio_with_volume_attached(self):
"""Test rescuing server with volume attached
Attach a volume to the server and then rescue the server with disk
and virtio as the rescue disk.
"""
server_id, rescue_image_id = self._create_server_and_rescue_image(
hw_rescue_device='disk', hw_rescue_bus='virtio')
server = self.servers_client.show_server(server_id)['server']
@ -192,12 +206,22 @@ class ServerStableDeviceRescueTest(BaseServerStableDeviceRescueTest):
class ServerBootFromVolumeStableRescueTest(BaseServerStableDeviceRescueTest):
"""Test rescuing server specifying type of device for the rescue disk
Test rescuing server specifying type of device for the rescue disk with
compute microversion greater than 2.86.
"""
min_microversion = '2.87'
@decorators.attr(type='slow')
@decorators.idempotent_id('48f123cb-922a-4065-8db6-b9a9074a556b')
def test_stable_device_rescue_bfv_blank_volume(self):
"""Test rescuing server with blank volume as block_device_mapping_v2
Create a server with block_device_mapping_v2 with blank volume,
then rescue the server with disk and virtio as the rescue disk.
"""
block_device_mapping_v2 = [{
"boot_index": "0",
"source_type": "blank",
@ -211,6 +235,11 @@ class ServerBootFromVolumeStableRescueTest(BaseServerStableDeviceRescueTest):
@decorators.attr(type='slow')
@decorators.idempotent_id('e4636333-c928-40fc-98b7-70a23eef4224')
def test_stable_device_rescue_bfv_image_volume(self):
"""Test rescuing server with blank volume as block_device_mapping_v2
Create a server with block_device_mapping_v2 with image volume,
then rescue the server with disk and virtio as the rescue disk.
"""
block_device_mapping_v2 = [{
"boot_index": "0",
"source_type": "image",

View File

@ -21,6 +21,8 @@ CONF = config.CONF
class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
"""Negative tests of volume attaching"""
create_default_network = True
@classmethod
@ -34,6 +36,7 @@ class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
@decorators.related_bug('1630783', status_code=500)
@decorators.idempotent_id('a313b5cd-fbd0-49cc-94de-870e99f763c7')
def test_delete_attached_volume(self):
"""Test deleting attachemd volume should fail"""
server = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()
self.attach_volume(server, volume)
@ -44,10 +47,13 @@ class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('aab919e2-d992-4cbb-a4ed-745c2475398c')
def test_attach_attached_volume_to_same_server(self):
# Test attaching the same volume to the same instance once
# it's already attached. The nova/cinder validation for this differs
# depending on whether or not cinder v3.27 is being used to attach
# the volume to the instance.
"""Test attaching attached volume to same server should fail
Test attaching the same volume to the same instance once
it's already attached. The nova/cinder validation for this differs
depending on whether or not cinder v3.27 is being used to attach
the volume to the instance.
"""
server = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()
@ -59,6 +65,7 @@ class AttachVolumeNegativeTest(base.BaseV2ComputeTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('ee37a796-2afb-11e7-bc0f-fa163e65f5ce')
def test_attach_attached_volume_to_different_server(self):
"""Test attaching attached volume to different server should fail"""
server1 = self.create_test_server(wait_until='ACTIVE')
volume = self.create_volume()