X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8b873a9b3b8865a4d451263e48b49122b9c32759..119720800f986c4f09601ff2bf65f0309fab8a99:/sdk/cwl/tests/test_container.py diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py index 3374e1c13f..d331e3552d 100644 --- a/sdk/cwl/tests/test_container.py +++ b/sdk/cwl/tests/test_container.py @@ -18,6 +18,7 @@ import os import functools import cwltool.process import cwltool.secrets +from cwltool.update import INTERNAL_VERSION from schema_salad.ref_resolver import Loader from schema_salad.sourceline import cmap @@ -60,7 +61,7 @@ class TestContainer(unittest.TestCase): cwltool.process._names = set() def helper(self, runner, enable_reuse=True): - document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema("v1.1") + document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema(INTERNAL_VERSION) make_fs_access=functools.partial(arvados_cwl.CollectionFsAccess, collection_cache=arvados_cwl.CollectionCache(runner.api, None, 0)) @@ -69,7 +70,7 @@ class TestContainer(unittest.TestCase): "basedir": "", "make_fs_access": make_fs_access, "loader": Loader({}), - "metadata": {"cwlVersion": "v1.1", "http://commonwl.org/cwltool#original_cwlVersion": "v1.0"}}) + "metadata": {"cwlVersion": INTERNAL_VERSION, "http://commonwl.org/cwltool#original_cwlVersion": "v1.0"}}) runtimeContext = arvados_cwl.context.ArvRuntimeContext( {"work_api": "containers", "basedir": "", @@ -402,7 +403,7 @@ class TestContainer(unittest.TestCase): runner.api.collections().get().execute.return_value = { "portable_data_hash": "99999999999999999999999999999993+99"} - document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema("v1.1") + document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema(INTERNAL_VERSION) tool = cmap({ "inputs": [], @@ -534,6 +535,25 @@ class TestContainer(unittest.TestCase): except RuntimeError: self.fail("RuntimeStatusLoggingHandler should not be called recursively") + + # Test to make sure that an exception raised from + # get_current_container doesn't cause the logger to raise an + # exception + @mock.patch("arvados_cwl.util.get_current_container") + def test_runtime_status_get_current_container_exception(self, gcc_mock): + self.setup_and_test_container_executor_and_logging(gcc_mock) + root_logger = logging.getLogger('') + + # get_current_container is invoked when we call + # runtime_status_update, it is going to also raise an + # exception. + gcc_mock.side_effect = Exception("Second Error") + try: + root_logger.error("First Error") + except Exception: + self.fail("Exception in logger should not propagate") + self.assertTrue(gcc_mock.called) + @mock.patch("arvados_cwl.ArvCwlExecutor.runtime_status_update") @mock.patch("arvados_cwl.util.get_current_container") @mock.patch("arvados.collection.CollectionReader") @@ -829,7 +849,7 @@ class TestWorkflow(unittest.TestCase): cwltool.process._names = set() def helper(self, runner, enable_reuse=True): - document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema("v1.1") + document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema("v1.0") make_fs_access=functools.partial(arvados_cwl.CollectionFsAccess, collection_cache=arvados_cwl.CollectionCache(runner.api, None, 0)) @@ -844,7 +864,7 @@ class TestWorkflow(unittest.TestCase): "basedir": "", "make_fs_access": make_fs_access, "loader": document_loader, - "metadata": {"cwlVersion": "v1.1", "http://commonwl.org/cwltool#original_cwlVersion": "v1.0"}, + "metadata": {"cwlVersion": INTERNAL_VERSION, "http://commonwl.org/cwltool#original_cwlVersion": "v1.0"}, "construct_tool_object": runner.arv_make_tool}) runtimeContext = arvados_cwl.context.ArvRuntimeContext( {"work_api": "containers", @@ -909,7 +929,7 @@ class TestWorkflow(unittest.TestCase): "--no-container", "--move-outputs", "--preserve-entire-environment", - "workflow.cwl#main", + "workflow.cwl", "cwl.input.yml" ], "container_image": "99999999999999999999999999999993+99", @@ -1057,7 +1077,7 @@ class TestWorkflow(unittest.TestCase): u'--no-container', u'--move-outputs', u'--preserve-entire-environment', - u'workflow.cwl#main', + u'workflow.cwl', u'cwl.input.yml' ], 'use_existing': True,