X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/55aafbb07904ca24390dd47ea960eae7cb2b909a..74e03b2190fea52b3ea5800c50eca55b6e50b220:/sdk/cwl/tests/test_submit.py diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py index 15cdc1e715..49545a83dc 100644 --- a/sdk/cwl/tests/test_submit.py +++ b/sdk/cwl/tests/test_submit.py @@ -79,7 +79,18 @@ def stubs(func): if uuid in (v["uuid"], v["portable_data_hash"]): return CollectionExecute(v) - created_collections = {} + created_collections = { + "99999999999999999999999999999998+99": { + "uuid": "", + "portable_data_hash": "99999999999999999999999999999998+99", + "manifest_text": ". 99999999999999999999999999999998+99 0:0:file1.txt" + }, + "99999999999999999999999999999994+99": { + "uuid": "", + "portable_data_hash": "99999999999999999999999999999994+99", + "manifest_text": ". 99999999999999999999999999999994+99 0:0:expect_arvworkflow.cwl" + } + } stubs.api.collections().create.side_effect = functools.partial(collection_createstub, created_collections) stubs.api.collections().get.side_effect = functools.partial(collection_getstub, created_collections) @@ -142,10 +153,23 @@ def stubs(func): 'runtime_constraints': {'docker_image': 'arvados/jobs:'+arvados_cwl.__version__, 'min_ram_mb_per_node': 1024}, 'script_parameters': { 'y': {"value": {'basename': '99999999999999999999999999999998+99', 'location': 'keep:99999999999999999999999999999998+99', 'class': 'Directory'}}, - 'x': {"value": {'basename': 'blorp.txt', 'class': 'File', 'location': 'keep:169f39d466a5438ac4a90e779bf750c7+53/blorp.txt'}}, + 'x': {"value": { + 'basename': 'blorp.txt', + 'class': 'File', + 'location': 'keep:169f39d466a5438ac4a90e779bf750c7+53/blorp.txt', + "nameext": ".txt", + "nameroot": "blorp", + "size": 16 + }}, 'z': {"value": {'basename': 'anonymous', 'class': 'Directory', 'listing': [ - {'basename': 'renamed.txt', 'class': 'File', 'location': 'keep:99999999999999999999999999999998+99/file1.txt'} + { + 'basename': 'renamed.txt', + 'class': 'File', 'location': + 'keep:99999999999999999999999999999998+99/file1.txt', + "nameext": ".txt", + "nameroot": "renamed" + } ]}}, 'cwl:tool': '3fffdeaa75e018172e1b583425f4ebff+60/workflow.cwl#main', 'arv:enable_reuse': True, @@ -191,10 +215,25 @@ def stubs(func): '/var/lib/cwl/cwl.input.json': { 'kind': 'json', 'content': { - 'y': {'basename': '99999999999999999999999999999998+99', 'location': 'keep:99999999999999999999999999999998+99', 'class': 'Directory'}, - 'x': {'basename': u'blorp.txt', 'class': 'File', 'location': u'keep:169f39d466a5438ac4a90e779bf750c7+53/blorp.txt'}, + 'y': { + 'basename': '99999999999999999999999999999998+99', + 'location': 'keep:99999999999999999999999999999998+99', + 'class': 'Directory'}, + 'x': { + 'basename': u'blorp.txt', + 'class': 'File', + 'location': u'keep:169f39d466a5438ac4a90e779bf750c7+53/blorp.txt', + "nameext": ".txt", + "nameroot": "blorp", + "size": 16 + }, 'z': {'basename': 'anonymous', 'class': 'Directory', 'listing': [ - {'basename': 'renamed.txt', 'class': 'File', 'location': 'keep:99999999999999999999999999999998+99/file1.txt'} + {'basename': 'renamed.txt', + 'class': 'File', + 'location': 'keep:99999999999999999999999999999998+99/file1.txt', + "nameext": ".txt", + "nameroot": "renamed" + } ]} }, 'kind': 'json' @@ -821,6 +860,31 @@ class TestSubmit(unittest.TestCase): stubs.expect_container_request_uuid + '\n') + @stubs + def test_submit_container_project(self, stubs): + project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz' + capture_stdout = cStringIO.StringIO() + try: + exited = arvados_cwl.main( + ["--submit", "--no-wait", "--api=containers", "--debug", "--project-uuid="+project_uuid, + "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"], + capture_stdout, sys.stderr, api_client=stubs.api, keep_client=stubs.keep_client) + self.assertEqual(exited, 0) + except: + logging.exception("") + + expect_container = copy.deepcopy(stubs.expect_container_spec) + expect_container["owner_uuid"] = project_uuid + expect_container["command"] = ['arvados-cwl-runner', '--local', '--api=containers', '--no-log-timestamps', + '--enable-reuse', '--on-error=continue', '--project-uuid='+project_uuid, + '/var/lib/cwl/workflow.json#main', '/var/lib/cwl/cwl.input.json'] + + stubs.api.container_requests().create.assert_called_with( + body=JsonDiffMatcher(expect_container)) + self.assertEqual(capture_stdout.getvalue(), + stubs.expect_container_request_uuid + '\n') + + @stubs def test_submit_job_runner_image(self, stubs): capture_stdout = cStringIO.StringIO()