Skip to content

Commit 63effb9

Browse files
author
Peter Amstutz
committed
Test logs errors
1 parent 9ae3528 commit 63effb9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

test/test_integration.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import shutil
99
import logging
1010
import sys
11+
import requests
1112

1213
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
1314
sys.path.insert(0, pkg_root) # noqa
@@ -60,7 +61,7 @@ def test_dockstore_md5sum(self):
6061
json_input=self.cwl_json_input,
6162
workflow_attachment=self.cwl_attachments)
6263
state = self.wait_for_finish(run_id)
63-
assert state == "COMPLETE"
64+
self.check_complete(run_id)
6465
self.assertTrue(check_for_file(outfile_path), 'Output file was not found: ' + str(outfile_path))
6566

6667
def test_local_md5sum(self):
@@ -69,7 +70,7 @@ def test_local_md5sum(self):
6970
json_input=self.cwl_json_input,
7071
workflow_attachment=self.cwl_attachments)
7172
state = self.wait_for_finish(run_id)
72-
assert state == "COMPLETE"
73+
self.check_complete(run_id)
7374
self.assertTrue(check_for_file(outfile_path), 'Output file was not found: ' + str(outfile_path))
7475

7576
def test_run_attachments(self):
@@ -79,7 +80,7 @@ def test_run_attachments(self):
7980
workflow_attachment=self.cwl_attachments)
8081
get_response = self.client.get_run_log(run_id)["request"]
8182
state = self.wait_for_finish(run_id)
82-
assert state == "COMPLETE"
83+
self.check_complete(run_id)
8384
self.assertTrue(check_for_file(outfile_path), 'Output file was not found: ' + get_response["workflow_attachment"])
8485
attachment_tool_path = get_response["workflow_attachment"][7:] + "/dockstore-tool-md5sum.cwl"
8586
self.assertTrue(check_for_file(attachment_tool_path), 'Attachment file was not found: ' + get_response["workflow_attachment"])
@@ -137,6 +138,14 @@ def wait_for_finish(self, run_id, seconds=120):
137138
r = self.client.get_run_status(run_id)
138139
return r["state"]
139140

141+
def check_complete(self, run_id):
142+
s = self.client.get_run_log(run_id)
143+
if s["state"] != "COMPLETE":
144+
logging.info(str(s["run_log"]["stderr"]))
145+
if str(s["run_log"]["stderr"]).startswith("http"):
146+
logs = requests.get(s["run_log"]["stderr"], headers=auth).text
147+
logging.info("Run log:\n" + logs)
148+
assert s["state"] == "COMPLETE"
140149

141150
def get_server_pids():
142151
try:

wes_client/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def cancel(self, run_id):
241241
:return: The body of the delete result as a dictionary.
242242
"""
243243
postresult = requests.post("%s://%s/ga4gh/wes/v1/runs/%s/cancel" % (self.proto, self.host, run_id),
244-
headers=self.auth)
244+
headers=self.auth)
245245
return wes_reponse(postresult)
246246

247247
def get_run_log(self, run_id):

0 commit comments

Comments
 (0)