Ensure bootable volume is gone in scenario test before tearDown

In test_create_server_from_volume_snapshot tearDown would trigger
bootable volume and snapshot deletion in the correct order but not
wait for the bootable volume to be deleted, causing snapshot
deletion to fail.

This change makes the scenario test explicitly delete the bootable
volume to avoid the race condition in tearDown.

Change-Id: I3fe2ce349ce629bfc96f6ddfb45b22687a1be137
Co-Authored-By: Alan Bishop <abishop@redhat.com>
Closes-Bug: 1863750
This commit is contained in:
Giulio Fidente 2020-03-04 10:15:03 +01:00
parent f61e18ff7b
commit 0d2b331cc4
1 changed files with 7 additions and 0 deletions

View File

@ -167,6 +167,13 @@ class TestVolumeBootPattern(manager.EncryptionScenarioTest):
self.assertEqual(created_volume[0]['id'],
created_volume_info['attachments'][0]['volume_id'])
# Delete the server and wait
self._delete_server(server)
# Assert that the underlying volume is gone before class tearDown
# to prevent snapshot deletion from failing
self.volumes_client.wait_for_resource_deletion(created_volume[0]['id'])
@decorators.idempotent_id('36c34c67-7b54-4b59-b188-02a2f458a63b')
@testtools.skipUnless(CONF.volume_feature_enabled.snapshot,
'Cinder volume snapshots are disabled')