[Optimize] Adds interval and increase waiting time

Gives more time to wait resource's status to change
in functional testcases and adds default interval
to reduce query amount.

Change-Id: I2a29a2d04836fd1261d45e404341bb1aa657417b
This commit is contained in:
TommyLike
2017-06-15 09:31:00 +08:00
parent 728e13442d
commit afa10404bc

View File

@@ -108,7 +108,7 @@ class ClientTestBase(base.ClientTestBase):
return (object_name + '-' + cmd if object_name != 'volume' else cmd)
def wait_for_object_status(self, object_name, object_id, status,
timeout=60):
timeout=120, interval=3):
"""Wait until object reaches given status.
:param object_name: object name
@@ -121,6 +121,7 @@ class ClientTestBase(base.ClientTestBase):
while time.time() - start_time < timeout:
if status in self.cinder(cmd, params=object_id):
break
time.sleep(interval)
else:
self.fail("%s %s did not reach status %s after %d seconds."
% (object_name, object_id, status, timeout))