From cbdda43d034b07bfeba9f711e4821c5c28c08e7f Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 9 Oct 2019 14:56:45 -0400 Subject: [PATCH] 15694: Add test Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- sdk/cwl/tests/test_container.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py index 3374e1c13f..b1034222ea 100644 --- a/sdk/cwl/tests/test_container.py +++ b/sdk/cwl/tests/test_container.py @@ -534,6 +534,21 @@ 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 + @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 + # so try and log again! + gcc_mock.side_effect = Exception("Second Error") + try: + root_logger.error("First Error") + except RuntimeError: + self.fail("RuntimeStatusLoggingHandler should not be called recursively") + @mock.patch("arvados_cwl.ArvCwlExecutor.runtime_status_update") @mock.patch("arvados_cwl.util.get_current_container") @mock.patch("arvados.collection.CollectionReader") -- 2.30.2