@@ -19,12 +19,16 @@ class IntegrationTest(unittest.TestCase):
19
19
"""A baseclass that's inherited for use with different cwl backends."""
20
20
@classmethod
21
21
def setUpClass (cls ):
22
-
22
+ # cwl
23
23
cls .cwl_dockstore_url = 'https://dockstore.org:8443/api/ga4gh/v2/tools/quay.io%2Fbriandoconnor%2Fdockstore-tool-md5sum/versions/master/plain-CWL/descriptor/%2FDockstore.cwl'
24
24
cls .cwl_local_path = os .path .abspath ('testdata/md5sum.cwl' )
25
- cls .json_input = "file://" + os .path .abspath ('testdata/md5sum.json' )
26
- cls .attachments = ['file://' + os .path .abspath ('testdata/md5sum.input' ),
27
- 'file://' + os .path .abspath ('testdata/dockstore-tool-md5sum.cwl' )]
25
+ cls .cwl_json_input = "file://" + os .path .abspath ('testdata/md5sum.json' )
26
+ cls .cwl_attachments = ['file://' + os .path .abspath ('testdata/md5sum.input' ),
27
+ 'file://' + os .path .abspath ('testdata/dockstore-tool-md5sum.cwl' )]
28
+ # wdl
29
+ cls .wdl_local_path = os .path .abspath ('testdata/md5sum.wdl' )
30
+ cls .wdl_json_input = "file://" + os .path .abspath ('testdata/md5sum.wdl.json' )
31
+ cls .wdl_attachments = ['file://' + os .path .abspath ('testdata/md5sum.input' )]
28
32
29
33
def setUp (self ):
30
34
"""Start a (local) wes-service server to make requests against."""
@@ -40,41 +44,32 @@ def tearDown(self):
40
44
time .sleep (3 )
41
45
except OSError as e :
42
46
print (e )
43
- if os .path .exists ('workflows' ):
44
- shutil .rmtree ('workflows' )
47
+ # if os.path.exists('workflows'):
48
+ # shutil.rmtree('workflows')
45
49
unittest .TestCase .tearDown (self )
46
50
47
51
def test_dockstore_md5sum (self ):
48
52
"""HTTP md5sum cwl (dockstore), run it on the wes-service server, and check for the correct output."""
49
53
outfile_path , _ = run_cwl_md5sum (cwl_input = self .cwl_dockstore_url ,
50
- json_input = self .json_input ,
51
- workflow_attachment = self .attachments )
54
+ json_input = self .cwl_json_input ,
55
+ workflow_attachment = self .cwl_attachments )
52
56
self .assertTrue (check_for_file (outfile_path ), 'Output file was not found: ' + str (outfile_path ))
53
57
54
58
def test_local_md5sum (self ):
55
59
"""LOCAL md5sum cwl to the wes-service server, and check for the correct output."""
56
60
outfile_path , run_id = run_cwl_md5sum (cwl_input = self .cwl_local_path ,
57
- json_input = self .json_input ,
58
- workflow_attachment = self .attachments )
61
+ json_input = self .cwl_json_input ,
62
+ workflow_attachment = self .cwl_attachments )
59
63
self .assertTrue (check_for_file (outfile_path ), 'Output file was not found: ' + str (outfile_path ))
60
64
61
- def test_multipart_upload (self ):
62
- """LOCAL md5sum cwl to the wes-service server, and check for uploaded file in service."""
63
- outfile_path , run_id = run_cwl_md5sum (cwl_input = self .cwl_local_path ,
64
- json_input = self .json_input ,
65
- workflow_attachment = self .attachments )
66
- get_response = get_log_request (run_id )["request" ]
67
- self .assertTrue (check_for_file (outfile_path ), 'Output file was not found: ' + get_response ["workflow_attachment" ])
68
- self .assertTrue (check_for_file (get_response ["workflow_url" ][7 :]), 'Output file was not found: ' + get_response ["workflow_url" ][:7 ])
69
-
70
65
def test_run_attachments (self ):
71
66
"""LOCAL md5sum cwl to the wes-service server, check for attachments."""
72
67
outfile_path , run_id = run_cwl_md5sum (cwl_input = self .cwl_local_path ,
73
- json_input = self .json_input ,
74
- workflow_attachment = self .attachments )
68
+ json_input = self .cwl_json_input ,
69
+ workflow_attachment = self .cwl_attachments )
75
70
get_response = get_log_request (run_id )["request" ]
76
- attachment_tool_path = get_response ["workflow_attachment" ][7 :] + "/dockstore-tool-md5sum.cwl"
77
71
self .assertTrue (check_for_file (outfile_path ), 'Output file was not found: ' + get_response ["workflow_attachment" ])
72
+ attachment_tool_path = get_response ["workflow_attachment" ][7 :] + "/dockstore-tool-md5sum.cwl"
78
73
self .assertTrue (check_for_file (attachment_tool_path ), 'Attachment file was not found: ' + get_response ["workflow_attachment" ])
79
74
80
75
@@ -90,25 +85,6 @@ def run_cwl_md5sum(cwl_input, json_input, workflow_attachment=None):
90
85
return os .path .join (output_dir , 'md5sum.txt' ), response ['run_id' ]
91
86
92
87
93
- def run_wdl_md5sum (wdl_input ):
94
- """Pass a local md5sum wdl to the wes-service server, and return the path of the output file that was created."""
95
- endpoint = 'http://localhost:8080/ga4gh/wes/v1/runs'
96
- params = '{"ga4ghMd5.inputFile": "' + os .path .abspath ('testdata/md5sum.input' ) + '"}'
97
- parts = [("workflow_params" , params ),
98
- ("workflow_type" , "WDL" ),
99
- ("workflow_type_version" , "v1.0" ),
100
- ("workflow_url" , wdl_input )]
101
- response = requests .post (endpoint , files = parts ).json ()
102
- output_dir = os .path .abspath (os .path .join ('workflows' , response ['workflow_id' ], 'outdir' ))
103
- check_travis_log = os .path .join (output_dir , 'stderr' )
104
- with open (check_travis_log , 'r' ) as f :
105
- logging .info (f .read ())
106
- logging .info (subprocess .check_output (['ls' , os .path .join ('workflows' , response ['workflow_id' ])]))
107
- logging .info ('\n ' )
108
- logging .info (subprocess .check_output (['ls' , output_dir ]))
109
- return os .path .join (output_dir , 'md5sum.txt' ), response ['workflow_id' ]
110
-
111
-
112
88
def get_log_request (run_id ):
113
89
endpoint = 'http://localhost:8080/ga4gh/wes/v1/runs/{}' .format (run_id )
114
90
return requests .get (endpoint ).json ()
@@ -159,6 +135,13 @@ def setUp(self):
159
135
shell = True )
160
136
time .sleep (5 )
161
137
138
+ def test_local_wdl (self ):
139
+ """LOCAL md5sum wdl to the wes-service server, and check for the correct output."""
140
+ outfile_path , run_id = run_cwl_md5sum (cwl_input = self .wdl_local_path ,
141
+ json_input = self .wdl_json_input ,
142
+ workflow_attachment = self .wdl_attachments )
143
+ self .assertTrue (check_for_file (outfile_path ), 'Output file was not found: ' + str (outfile_path ))
144
+
162
145
163
146
# Prevent pytest/unittest's discovery from attempting to discover the base test class.
164
147
del IntegrationTest
0 commit comments