Wait on jobs and history in certain API test cases.

This strategy proved to work around certain race conditions in tool testing so hopefully it will solve the transiently failing job searching and filtering test cases.
This commit is contained in:
John Chilton
2015-12-18 13:25:48 +00:00
parent ffb973477b
commit 641b275aa4
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -70,10 +70,14 @@ class BaseDatasetPopulator( object ):
Galaxy - implementations must implement _get and _post.
"""
def new_dataset( self, history_id, content='TestData123', **kwds ):
def new_dataset( self, history_id, content='TestData123', wait=False, **kwds ):
payload = self.upload_payload( history_id, content, **kwds )
run_response = self._post( "tools", data=payload )
return run_response.json()["outputs"][0]
run_response = self._post( "tools", data=payload ).json()
if wait:
job = run_response["jobs"][0]
self.wait_for_job(job["id"])
self.wait_for_history(history_id)
return run_response["outputs"][0]
def wait_for_history( self, history_id, assert_ok=False, timeout=DEFAULT_TIMEOUT ):
try:
+2 -2
View File
@@ -200,8 +200,8 @@ class JobsApiTestCase( api.ApiTestCase, TestsDatasets ):
return history_id, dataset_id
def __history_with_ok_dataset( self ):
history_id, dataset_id = self.__history_with_new_dataset()
self._wait_for_history( history_id, assert_ok=True )
history_id = self._new_history()
dataset_id = self._new_dataset( history_id, wait=True )[ "id" ]
return history_id, dataset_id
def __jobs_index( self, **kwds ):