Remove redundant waiter in create_volume cleanup
If wait_on_delete is True we are already waiting
for the volume delete, so the addCleanup_with_wait
call is redundant.
This just changes the addCleanup_with_wait call
to a normal addCleanup on the volume delete in
the case that wait_on_delete is True.
If wait_on_delete is False we still do the delete
but the wait is moved to the end of the test run
so it's asynchronous.
Change-Id: I6c4cd1a00ddc79de4c59c512b2d794e7380591f2
Partial-Bug: #1367857
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index dfd4658..101b165 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -264,14 +264,18 @@
_, volume = self.volumes_client.create_volume(
size=size, display_name=name, snapshot_id=snapshot_id,
imageRef=imageRef, volume_type=volume_type)
+
if wait_on_delete:
self.addCleanup(self.volumes_client.wait_for_resource_deletion,
volume['id'])
- self.addCleanup_with_wait(
- waiter_callable=self.volumes_client.wait_for_resource_deletion,
- thing_id=volume['id'], thing_id_param='id',
- cleanup_callable=self.delete_wrapper,
- cleanup_args=[self.volumes_client.delete_volume, volume['id']])
+ self.addCleanup(self.delete_wrapper,
+ self.volumes_client.delete_volume, volume['id'])
+ else:
+ self.addCleanup_with_wait(
+ waiter_callable=self.volumes_client.wait_for_resource_deletion,
+ thing_id=volume['id'], thing_id_param='id',
+ cleanup_callable=self.delete_wrapper,
+ cleanup_args=[self.volumes_client.delete_volume, volume['id']])
self.assertEqual(name, volume['display_name'])
self.volumes_client.wait_for_volume_status(volume['id'], 'available')