From 14294d0c84fc96c649276d0902735f925032917a Mon Sep 17 00:00:00 2001 From: Sam Morris Date: Wed, 13 Mar 2024 17:26:59 +0000 Subject: [PATCH] timeout errors are critical --- src/ipahealthcheck/core/core.py | 3 +-- tests/test_plugins.py | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ipahealthcheck/core/core.py b/src/ipahealthcheck/core/core.py index 829a717..c4abd2f 100644 --- a/src/ipahealthcheck/core/core.py +++ b/src/ipahealthcheck/core/core.py @@ -111,8 +111,7 @@ def signal_handler(signum, frame): # caught our TimeoutError and logged something misleading; in that # case let's err on the side of caution and return an additional # result. - # TODO: suggest that timeouts are CRITICAL? - yield Result(plugin, constants.ERROR, + yield Result(plugin, constants.CRITICAL, exception=str(timed_out["exception"]), key="healthcheck_timeout", start=start, traceback=timed_out["stack"]) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index f7d7eb5..e21c84a 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -87,13 +87,13 @@ def check(self): assert results.results[0].kw.get('exception') == 'Check' \ ' test_plugins:plugin_slow_passing_exception_up' \ ' cancelled after 1 sec' - assert results.results[0].result == constants.ERROR + assert results.results[0].result == constants.CRITICAL assert results.results[0].kw.get('key') == 'healthcheck_timeout' assert results.results[1].kw.get('exception') == 'Check' \ ' test_plugins:plugin_slow_catching_exception_and_ignoring' \ ' cancelled after 1 sec' - assert results.results[1].result == constants.ERROR + assert results.results[1].result == constants.CRITICAL assert results.results[1].kw.get('key') == 'healthcheck_timeout' assert results.results[2].kw.get('exception') == 'Check' \ @@ -106,7 +106,7 @@ def check(self): assert results.results[3].kw.get('exception') == 'Check' \ ' test_plugins:plugin_slow_catching_exception_and_handling' \ ' cancelled after 1 sec' - assert results.results[3].result == constants.ERROR + assert results.results[3].result == constants.CRITICAL assert results.results[3].kw.get('key') == 'healthcheck_timeout' assert results.results[4].kw.get('exception') == "I didn't expect an" \ @@ -116,7 +116,7 @@ def check(self): assert results.results[5].kw.get('exception') == 'Check' \ ' test_plugins:plugin_slow_raising_exception cancelled after 1 sec' - assert results.results[5].result == constants.ERROR + assert results.results[5].result == constants.CRITICAL assert results.results[5].kw.get('key') == 'healthcheck_timeout' assert results.results[6].kw.get('msg') == 'pass'