update tests for bug 2112187
This change updates: tempest.api.compute.admin.test_volumes_negative. VolumesAdminNegativeTest. test_update_attached_volume_with_nonexistent_volume_in_body and test_multiattach_rw_volume_update_failure and tempest.api.compute.admin.test_volume_swap.TestVolumeSwap. test_volume_swap to account for the fact that only cinder may call attachemnt update aka swap_volume. The tests now assert the expected 409 and are annotated with the skip_because decorator to allow the nova change to be backported while allowign tempest to pass on both master and stable branches by skiping the affected test until all branches are in sync. Change-Id: I72fdfe98c5c8b11d76bd2b212174d5617b081e25 Signed-off-by: Sean Mooney <work@seanmooney.info> Related-Bug: #2112187 Signed-off-by: Balazs Gibizer <gibi@redhat.com>
This commit is contained in:
committed by
Balazs Gibizer
parent
e7e3947694
commit
290069b157
@@ -80,6 +80,7 @@ class TestVolumeSwap(TestVolumeSwapBase):
|
||||
# to swap volumes directly; swap volume is primarily only for volume
|
||||
# live migration and retype callbacks from the volume service, and is slow
|
||||
# so it's marked as such.
|
||||
@decorators.skip_because(bug='2112187')
|
||||
@decorators.attr(type='slow')
|
||||
@decorators.idempotent_id('1769f00d-a693-4d67-a631-6a3496773813')
|
||||
def test_volume_swap(self):
|
||||
@@ -92,10 +93,7 @@ class TestVolumeSwap(TestVolumeSwapBase):
|
||||
3. Boot an instance "instance1" with non-admin.
|
||||
4. Attach "volume1" to "instance1" with non-admin.
|
||||
5. Swap volume from "volume1" to "volume2" as admin.
|
||||
6. Check the swap volume is successful and "volume2"
|
||||
is attached to "instance1" and "volume1" is in available state.
|
||||
7. Swap volume from "volume2" to "volume1" as admin.
|
||||
8. Check the swap volume is successful and "volume1"
|
||||
6. Check the swap volume is rejected and "volume1"
|
||||
is attached to "instance1" and "volume2" is in available state.
|
||||
"""
|
||||
# Create two volumes.
|
||||
@@ -118,34 +116,19 @@ class TestVolumeSwap(TestVolumeSwapBase):
|
||||
# Attach "volume1" to server
|
||||
self.attach_volume(server, volume1)
|
||||
# Swap volume from "volume1" to "volume2"
|
||||
self.admin_servers_client.update_attached_volume(
|
||||
self.assertRaises(
|
||||
lib_exc.Conflict, self.admin_servers_client.update_attached_volume,
|
||||
server['id'], volume1['id'], volumeId=volume2['id'])
|
||||
waiters.wait_for_volume_resource_status(self.volumes_client,
|
||||
volume1['id'], 'available')
|
||||
waiters.wait_for_volume_resource_status(self.volumes_client,
|
||||
volume2['id'], 'in-use')
|
||||
self.wait_for_server_volume_swap(server['id'], volume1['id'],
|
||||
volume2['id'])
|
||||
# Verify "volume2" is attached to the server
|
||||
vol_attachments = self.servers_client.list_volume_attachments(
|
||||
server['id'])['volumeAttachments']
|
||||
self.assertEqual(1, len(vol_attachments))
|
||||
self.assertIn(volume2['id'], vol_attachments[0]['volumeId'])
|
||||
|
||||
# Swap volume from "volume2" to "volume1"
|
||||
self.admin_servers_client.update_attached_volume(
|
||||
server['id'], volume2['id'], volumeId=volume1['id'])
|
||||
waiters.wait_for_volume_resource_status(self.volumes_client,
|
||||
volume2['id'], 'available')
|
||||
waiters.wait_for_volume_resource_status(self.volumes_client,
|
||||
volume1['id'], 'in-use')
|
||||
self.wait_for_server_volume_swap(server['id'], volume2['id'],
|
||||
volume1['id'])
|
||||
# Verify "volume1" is attached to the server
|
||||
vol_attachments = self.servers_client.list_volume_attachments(
|
||||
server['id'])['volumeAttachments']
|
||||
self.assertEqual(1, len(vol_attachments))
|
||||
self.assertIn(volume1['id'], vol_attachments[0]['volumeId'])
|
||||
waiters.wait_for_volume_resource_status(
|
||||
self.volumes_client, volume1['id'], 'in-use')
|
||||
# verify "volume2" is still available
|
||||
waiters.wait_for_volume_resource_status(
|
||||
self.volumes_client, volume2['id'], 'available')
|
||||
|
||||
|
||||
class TestMultiAttachVolumeSwap(TestVolumeSwapBase):
|
||||
|
||||
@@ -51,6 +51,7 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
|
||||
self.server['id'], nonexistent_volume,
|
||||
volumeId=volume['id'])
|
||||
|
||||
@decorators.skip_because(bug='2112187')
|
||||
@decorators.related_bug('1629110', status_code=400)
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('7dcac15a-b107-46d3-a5f6-cb863f4e454a')
|
||||
@@ -71,7 +72,7 @@ class VolumesAdminNegativeTest(base.BaseV2ComputeAdminTest):
|
||||
self.attach_volume(self.server, volume)
|
||||
|
||||
nonexistent_volume = data_utils.rand_uuid()
|
||||
self.assertRaises(lib_exc.BadRequest,
|
||||
self.assertRaises(lib_exc.Conflict,
|
||||
self.admin_servers_client.update_attached_volume,
|
||||
self.server['id'], volume['id'],
|
||||
volumeId=nonexistent_volume)
|
||||
@@ -104,6 +105,7 @@ class UpdateMultiattachVolumeNegativeTest(base.BaseV2ComputeAdminTest):
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('7576d497-b7c6-44bd-9cc5-c5b4e50fec71')
|
||||
@utils.services('volume')
|
||||
@decorators.skip_because(bug='2112187')
|
||||
def test_multiattach_rw_volume_update_failure(self):
|
||||
"""Test swapping volume attached to multi-servers with read-write mode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user