Increase max wait time, avoid racy failure in gate

The test_task_api fails intermittently in gate.

Example:
http://logs.openstack.org/15/293415/2/check/gate-glance-python27/6a96731/testr_results.html.gz

The reason behind this is that the recent addition of flows to tasks
take extra time. When this test was written it considered execution time
for limited script length. Some of the nodes in the gate might be slower
than others resulting into these intermittent failures.

Until we come up with better way to control the flows that run by
default on tasks, we don't have a good way to run smaller script. The
increase of timeout doesn't hurt as much as the sleep interval is 0.05
seconds so, only the slower runs in the gate/dev box will be affected.

Co-Authored-By: Nikhil Komawar<nik.komawar@gmail.com>

Change-Id: I80f04f8b6a23c208f9553b398c8f5db05190bebb
This commit is contained in:
Fei Long Wang 2016-03-03 13:43:12 +13:00
parent 27152da332
commit 143df036fa
1 changed files with 4 additions and 4 deletions

View File

@ -57,15 +57,15 @@ class TestTasksApi(base.ApiTest):
self.api_flavor = 'fakeauth'
self.registry_flavor = 'fakeauth'
def _wait_on_task_execution(self):
def _wait_on_task_execution(self, max_wait=5):
"""Wait until all the tasks have finished execution and are in
state of success or failure.
"""
start = timeutils.utcnow()
# wait for maximum of 5 seconds
while timeutils.delta_seconds(start, timeutils.utcnow()) < 5:
# wait for maximum of seconds defined by max_wait
while timeutils.delta_seconds(start, timeutils.utcnow()) < max_wait:
wait = False
# Verify that no task is in status of pending or processing
path = "/v2/tasks"
@ -151,7 +151,7 @@ class TestTasksApi(base.ApiTest):
# NOTE(sabari): wait for all task executions to finish before checking
# task status.
self._wait_on_task_execution()
self._wait_on_task_execution(max_wait=10)
# 4. GET /tasks
# Get all tasks (not deleted)