Add error handling to smoke test cleanup.
* DefaultClientSmokeTest.tearDownClass was previously calling
delete() on test resources without error handling. Since the
intent of the method is to remove test resources, a NotFound
exception indicating that the resource has already been
removed can safely be ignored.
Change-Id: Idd289d2f3ce4133c49b0c882304d6ad6695a7396
diff --git a/tempest/smoke.py b/tempest/smoke.py
index 68d0927..1e7da8e 100644
--- a/tempest/smoke.py
+++ b/tempest/smoke.py
@@ -56,9 +56,15 @@
LOG.debug("Deleting %r from shared resources of %s" %
(thing, cls.__name__))
- # OpenStack resources are assumed to have a delete()
- # method which destroys the resource...
- thing.delete()
+ try:
+ # OpenStack resources are assumed to have a delete()
+ # method which destroys the resource...
+ thing.delete()
+ except Exception as e:
+ # If the resource is already missing, mission accomplished.
+ if e.__class__.__name__ == 'NotFound':
+ continue
+ raise
def is_deletion_complete():
# Deletion testing is only required for objects whose