From 62dadfe25c875a6eb889746295d2827410078088 Mon Sep 17 00:00:00 2001 From: Tullio Sebastiani Date: Fri, 20 Mar 2026 16:08:56 +0100 Subject: [PATCH] Resiliency Score krknctl compatibility fixes (#1195) * added console log of the resiliency score when mode is "detailed" Signed-off-by: Tullio Sebastiani * base image krknctl input Signed-off-by: Tullio Sebastiani resiliency score flag Signed-off-by: Tullio Sebastiani * removed json print in run_krkn.py Signed-off-by: Tullio Sebastiani * unit test fix Signed-off-by: Tullio Sebastiani --------- Signed-off-by: Tullio Sebastiani --- containers/krknctl-input.json | 26 ++++++++++++++++++++++++++ krkn/resiliency/resiliency.py | 2 +- scenarios/kube/cpu-hog.yml | 2 +- tests/test_resiliency.py | 2 +- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/containers/krknctl-input.json b/containers/krknctl-input.json index a373a59a..a0f079f6 100644 --- a/containers/krknctl-input.json +++ b/containers/krknctl-input.json @@ -558,5 +558,31 @@ "separator": ",", "default": "False", "required": "false" + }, + { + "name": "resiliency-score", + "short_description": "Enable resiliency score calculation", + "description": "The system outputs a detailed resiliency score as a single-line JSON object, facilitating easy aggregation across multiple test scenarios.", + "variable": "RESILIENCY_SCORE", + "type": "boolean", + "required": "false" + }, + { + "name": "disable-resiliency-score", + "short_description": "Disable resiliency score calculation", + "description": "Disable resiliency score calculation", + "variable": "DISABLE_RESILIENCY_SCORE", + "type": "boolean", + "required": "false" + }, + { + "name": "resiliency-file", + "short_description": "Resiliency Score metrics file", + "description": "Custom Resiliency score file", + "variable": "RESILIENCY_FILE", + "type": "file", + "required": "false", + "mount_path": "/home/krkn/resiliency-file.yaml" } + ] \ No newline at end of file diff --git a/krkn/resiliency/resiliency.py b/krkn/resiliency/resiliency.py index b43f7ba9..f6cad1ae 100644 --- a/krkn/resiliency/resiliency.py +++ b/krkn/resiliency/resiliency.py @@ -320,7 +320,7 @@ class Resiliency: ) detailed = self.get_detailed_report() - if run_mode == "controller": + if run_mode == "detailed": # krknctl expects the detailed report on stdout in a special format try: detailed_json = json.dumps(detailed) diff --git a/scenarios/kube/cpu-hog.yml b/scenarios/kube/cpu-hog.yml index 502ba74e..ca7d4ef3 100644 --- a/scenarios/kube/cpu-hog.yml +++ b/scenarios/kube/cpu-hog.yml @@ -1,4 +1,4 @@ -duration: 60 +duration: 10 workers: '' # leave it empty '' node cpu auto-detection hog-type: cpu image: quay.io/krkn-chaos/krkn-hog diff --git a/tests/test_resiliency.py b/tests/test_resiliency.py index 59cab099..0781f8c6 100644 --- a/tests/test_resiliency.py +++ b/tests/test_resiliency.py @@ -597,7 +597,7 @@ class TestFinalizeAndSave(unittest.TestCase): prom_cli=self.mock_prom, total_start_time=self.start, total_end_time=self.end, - run_mode="controller", + run_mode="detailed", ) mock_print.assert_called()