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