[scenario] Wait for image deletion
This operation requires some time to delete image completely
from cinder backend on lvm storage.
Related-Bug: PRODX-26356
Change-Id: Iaf7582444b9d123de0a41ee383a1ddbf7515a748
diff --git a/barbican_tempest_plugin/tests/scenario/manager.py b/barbican_tempest_plugin/tests/scenario/manager.py
index b7f8914..8620731 100644
--- a/barbican_tempest_plugin/tests/scenario/manager.py
+++ b/barbican_tempest_plugin/tests/scenario/manager.py
@@ -20,6 +20,7 @@
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
+from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions as lib_exc
from tempest.scenario import manager
@@ -57,7 +58,10 @@
params.update(properties)
body = self.image_client.create_image(**params)
image = body['image'] if 'image' in body else body
- self.addCleanup(self.image_client.delete_image, image['id'])
+ self.addCleanup(self.image_client.wait_for_resource_deletion,
+ image['id'])
+ self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+ self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
with open(path, 'rb') as image_file:
if CONF.image_feature_enabled.api_v1: