Better timeout exception in wait_for_resource_deletion
The generic rest_client.wait_for_resource_deletion
doesn't put anything into the TimeoutException that's
raised which makes it harder to debug failures.
This follows the pattern in the common waiters module
to put the test information and the resource id into
the TimeoutException message.
Change-Id: Ib0f30f15d5147aab63da35efec2f899e3ca31990
Related-Bug: #1367857
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 132d0a6..e584cbf 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -552,7 +552,13 @@
if self.is_resource_deleted(id):
return
if int(time.time()) - start_time >= self.build_timeout:
- raise exceptions.TimeoutException
+ message = ('Failed to delete resource %(id)s within the '
+ 'required time (%(timeout)s s).' %
+ {'id': id, 'timeout': self.build_timeout})
+ caller = misc_utils.find_test_caller()
+ if caller:
+ message = '(%s) %s' % (caller, message)
+ raise exceptions.TimeoutException(message)
time.sleep(self.build_interval)
def is_resource_deleted(self, id):