Skip to content

Commit

Permalink
Merge pull request #1062 from jmchilton/test_fixes
Browse files Browse the repository at this point in the history
[15.10] Test timeout fixes?
  • Loading branch information
nsoranzo committed Nov 11, 2015
2 parents 6953bdf + 177f73f commit 3a78d9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions test/api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _create_collection( self, payload ):
return create_response


def wait_on_state( state_func, assert_ok=False, timeout=5 ):
def wait_on_state( state_func, assert_ok=False, timeout=DEFAULT_TIMEOUT ):
def get_state( ):
response = state_func()
assert response.status_code == 200, "Failed to fetch state update while waiting."
Expand All @@ -454,12 +454,16 @@ def get_state( ):
return wait_on( get_state, desc="state", timeout=timeout)


def wait_on( function, desc, timeout=5 ):
def wait_on( function, desc, timeout=DEFAULT_TIMEOUT ):
delta = .25
iteration = 0
while True:
if (delta * iteration) > timeout:
assert False, "Timed out waiting on %s." % desc
total_wait = delta * iteration
if total_wait > timeout:
timeout_message = "Timed out after %s seconds waiting on %s." % (
total_wait, desc
)
assert False, timeout_message
iteration += 1
value = function()
if value is not None:
Expand Down
2 changes: 1 addition & 1 deletion test/api/test_workflow_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def __setup_and_run_cat1_workflow( self, history_id ):
run_workflow_response = self._post( "workflows", data=workflow_request )
self._assert_status_code_is( run_workflow_response, 200 )

self.dataset_populator.wait_for_history( history_id, assert_ok=True, timeout=10 )
self.dataset_populator.wait_for_history( history_id, assert_ok=True )
return self.__cat_job_id( history_id )

def _assert_first_step_is_paired_input( self, downloaded_workflow ):
Expand Down

0 comments on commit 3a78d9d

Please sign in to comment.