From b725de6653680561006c3185ba1a67378d51a685 Mon Sep 17 00:00:00 2001 From: Michael Engel Date: Wed, 3 Dec 2025 13:44:37 +0100 Subject: [PATCH 1/3] Remove test data with too long log configs The test cases for too long log configs (level, target and isquiet) causes the bluechi-agent service to fail (as expected). However, this happens in the test setup phase where we expect a running agent. Due to timing issues this check might even pass, depending how fast the status is being checked. This causes the test to be flacky. Since such a long input for log configs is unrealistic and the proper level for testing is on the unit level (test without the long data is already in place), these cases have een removed. In addition, the unused BluechiConfig variable for max line length has been removed. Signed-off-by: Michael Engel --- tests/bluechi_test/config.py | 4 ---- .../bluechi-agent-logisquiet/test_agent_logisquiet.py | 10 ---------- .../bluechi-agent-loglevel/test_agent_loglevel.py | 10 ---------- .../bluechi-agent-logtarget/test_agent_logtarget.py | 10 ---------- 4 files changed, 34 deletions(-) diff --git a/tests/bluechi_test/config.py b/tests/bluechi_test/config.py index 25962549be..6775ca4fa2 100644 --- a/tests/bluechi_test/config.py +++ b/tests/bluechi_test/config.py @@ -8,10 +8,6 @@ class BluechiConfig: - # use a smaller max line length than possible - # to prevent any accidental faults - MAX_LINE_LENGTH = 400 - def __init__(self, file_name: str) -> None: self.file_name = file_name diff --git a/tests/tests/tier0/bluechi-agent-logisquiet/test_agent_logisquiet.py b/tests/tests/tier0/bluechi-agent-logisquiet/test_agent_logisquiet.py index 0b0e7cecf3..dcb9d2226b 100644 --- a/tests/tests/tier0/bluechi-agent-logisquiet/test_agent_logisquiet.py +++ b/tests/tests/tier0/bluechi-agent-logisquiet/test_agent_logisquiet.py @@ -10,7 +10,6 @@ from bluechi_test.test import BluechiTest NODE_GOOD = "node-good" -NODE_WITH_LONG_LOGISQUIET = "node-long-logisquiet" NODE_WITH_NOT_VALID_VALUE = "node-with-not-valid-value" NODE_WITH_NUMBERS_ONLY_IN_LOGISQUIET = "node-numbers-only" @@ -21,9 +20,6 @@ def start_with_invalid_logisquiet( node_good = nodes[NODE_GOOD] assert node_good.wait_for_unit_state_to_be("bluechi-agent", "active") - node_with_log_logisquiet = nodes[NODE_WITH_LONG_LOGISQUIET] - assert node_with_log_logisquiet.wait_for_unit_state_to_be("bluechi-agent", "failed") - node_with_not_valid_value = nodes[NODE_WITH_NOT_VALID_VALUE] assert node_with_not_valid_value.wait_for_unit_state_to_be( "bluechi-agent", "active" @@ -45,10 +41,6 @@ def test_agent_invalid_configuration( node_good_cfg.node_name = NODE_GOOD node_good_cfg.log_is_quiet = "false" - node_with_long_logisquiet_cfg = bluechi_node_default_config.deep_copy() - node_with_long_logisquiet_cfg.node_name = NODE_WITH_LONG_LOGISQUIET - node_with_long_logisquiet_cfg.log_is_quiet = "NO_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION" # noqa: E501, E261 - node_with_invalid_value_cfg = bluechi_node_default_config.deep_copy() node_with_invalid_value_cfg.node_name = NODE_WITH_NOT_VALID_VALUE node_with_invalid_value_cfg.log_is_quiet = "NOT_TRUE_OR_FALSE_VALUE" @@ -61,7 +53,6 @@ def test_agent_invalid_configuration( bluechi_ctrl_default_config.allowed_node_names = [ NODE_GOOD, - NODE_WITH_LONG_LOGISQUIET, NODE_WITH_NOT_VALID_VALUE, NODE_WITH_NUMBERS_ONLY_IN_LOGISQUIET, ] @@ -69,7 +60,6 @@ def test_agent_invalid_configuration( bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) bluechi_test.add_bluechi_agent_config(node_good_cfg) - bluechi_test.add_bluechi_agent_config(node_with_long_logisquiet_cfg) bluechi_test.add_bluechi_agent_config(node_with_invalid_value_cfg) bluechi_test.add_bluechi_agent_config(node_with_numbersonly_in_logisquiet_cfg) diff --git a/tests/tests/tier0/bluechi-agent-loglevel/test_agent_loglevel.py b/tests/tests/tier0/bluechi-agent-loglevel/test_agent_loglevel.py index 06417c5071..cc04131bc6 100644 --- a/tests/tests/tier0/bluechi-agent-loglevel/test_agent_loglevel.py +++ b/tests/tests/tier0/bluechi-agent-loglevel/test_agent_loglevel.py @@ -10,7 +10,6 @@ from bluechi_test.test import BluechiTest NODE_GOOD = "node-good" -NODE_WITH_LONG_LOGLEVEL = "node-long-loglevel" NODE_WITH_NOT_VALID_VALUE = "node-with-not-valid-value" NODE_WITH_NUMBERS_ONLY_IN_LOGLEVEL = "node-numbers-only" @@ -22,9 +21,6 @@ def start_with_invalid_loglevel( node_good = nodes[NODE_GOOD] assert node_good.wait_for_unit_state_to_be("bluechi-agent", "active") - node_with_log_loglevel = nodes[NODE_WITH_LONG_LOGLEVEL] - assert node_with_log_loglevel.wait_for_unit_state_to_be("bluechi-agent", "failed") - node_with_not_valid_value = nodes[NODE_WITH_NOT_VALID_VALUE] assert node_with_not_valid_value.wait_for_unit_state_to_be( "bluechi-agent", "active" @@ -46,10 +42,6 @@ def test_agent_invalid_configuration( node_good_cfg.node_name = NODE_GOOD node_good_cfg.log_level = "INFO" - node_with_long_loglevel_cfg = bluechi_node_default_config.deep_copy() - node_with_long_loglevel_cfg.node_name = NODE_WITH_LONG_LOGLEVEL - node_with_long_loglevel_cfg.log_level = "NO_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION" # noqa: E501, E261 - node_with_invalid_value_cfg = bluechi_node_default_config.deep_copy() node_with_invalid_value_cfg.node_name = NODE_WITH_NOT_VALID_VALUE node_with_invalid_value_cfg.log_level = "NOT_INFO_OR_DEBUG_OR_WARN_OR_ERROR_VALUE" @@ -60,7 +52,6 @@ def test_agent_invalid_configuration( bluechi_ctrl_default_config.allowed_node_names = [ NODE_GOOD, - NODE_WITH_LONG_LOGLEVEL, NODE_WITH_NOT_VALID_VALUE, NODE_WITH_NUMBERS_ONLY_IN_LOGLEVEL, ] @@ -68,7 +59,6 @@ def test_agent_invalid_configuration( bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) bluechi_test.add_bluechi_agent_config(node_good_cfg) - bluechi_test.add_bluechi_agent_config(node_with_long_loglevel_cfg) bluechi_test.add_bluechi_agent_config(node_with_invalid_value_cfg) bluechi_test.add_bluechi_agent_config(node_with_numbersonly_in_loglevel_cfg) diff --git a/tests/tests/tier0/bluechi-agent-logtarget/test_agent_logtarget.py b/tests/tests/tier0/bluechi-agent-logtarget/test_agent_logtarget.py index 8c28dd2940..6982b9ec38 100644 --- a/tests/tests/tier0/bluechi-agent-logtarget/test_agent_logtarget.py +++ b/tests/tests/tier0/bluechi-agent-logtarget/test_agent_logtarget.py @@ -10,7 +10,6 @@ from bluechi_test.test import BluechiTest NODE_GOOD = "node-good" -NODE_WITH_LONG_LOGTARGET = "node-long-logtarget" NODE_WITH_NOT_VALID_VALUE = "node-with-not-valid-value" NODE_WITH_NUMBERS_ONLY_IN_LOGTARGET = "node-numbers-only" @@ -21,9 +20,6 @@ def start_with_invalid_logtarget( node_good = nodes[NODE_GOOD] assert node_good.wait_for_unit_state_to_be("bluechi-agent", "active") - node_with_long_logtarget = nodes[NODE_WITH_LONG_LOGTARGET] - assert node_with_long_logtarget.wait_for_unit_state_to_be("bluechi-agent", "failed") - node_with_numbers_only_in_logtarget = nodes[NODE_WITH_NUMBERS_ONLY_IN_LOGTARGET] assert node_with_numbers_only_in_logtarget.wait_for_unit_state_to_be( "bluechi-agent", "active" @@ -45,10 +41,6 @@ def test_agent_invalid_logtarget_configuration( node_good_cfg.node_name = NODE_GOOD node_good_cfg.log_target = "stderr" - node_with_long_logtarget_cfg = bluechi_node_default_config.deep_copy() - node_with_long_logtarget_cfg.node_name = NODE_WITH_LONG_LOGTARGET - node_with_long_logtarget_cfg.log_target = "NO_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION_NOT_REALLY_A_VALID_OPTION" # noqa: E501, E261 - node_with_invalid_value_cfg = bluechi_node_default_config.deep_copy() node_with_invalid_value_cfg.node_name = NODE_WITH_NOT_VALID_VALUE node_with_invalid_value_cfg.log_target = "NOT_STDERR_OR_JOURNALD_VALUE" @@ -61,7 +53,6 @@ def test_agent_invalid_logtarget_configuration( bluechi_ctrl_default_config.allowed_node_names = [ NODE_GOOD, - NODE_WITH_LONG_LOGTARGET, NODE_WITH_NOT_VALID_VALUE, NODE_WITH_NUMBERS_ONLY_IN_LOGTARGET, ] @@ -69,7 +60,6 @@ def test_agent_invalid_logtarget_configuration( bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) bluechi_test.add_bluechi_agent_config(node_good_cfg) - bluechi_test.add_bluechi_agent_config(node_with_long_logtarget_cfg) bluechi_test.add_bluechi_agent_config(node_with_invalid_value_cfg) bluechi_test.add_bluechi_agent_config(node_with_numbersonly_in_logtarget_cfg) From e73422d9924285878d5e0547da38d1317f9d019b Mon Sep 17 00:00:00 2001 From: Michael Engel Date: Fri, 4 Jul 2025 12:38:32 +0200 Subject: [PATCH 2/3] Update is-enabled integration test Since systemd 253, systemctl returns error code 4 when the is-enabled command is applied to non-existent unit. This differs from bluechictl is-enabled since here the error code for the sd_bus_call_method is returned. Signed-off-by: Michael Engel --- .../test_bluechictl_is_enabled.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/tests/tier0/bluechictl-is-enabled/test_bluechictl_is_enabled.py b/tests/tests/tier0/bluechictl-is-enabled/test_bluechictl_is_enabled.py index fb7a690c54..fba227941f 100644 --- a/tests/tests/tier0/bluechictl-is-enabled/test_bluechictl_is_enabled.py +++ b/tests/tests/tier0/bluechictl-is-enabled/test_bluechictl_is_enabled.py @@ -21,6 +21,7 @@ def check_execs( ctrl: BluechiControllerMachine, node: BluechiAgentMachine, unit_name: str, + unit_exists: bool = True, check_output: bool = True, ): bc_res, bc_out = ctrl.bluechictl.is_enabled( @@ -28,7 +29,14 @@ def check_execs( ) sc_res, sc_out = node.systemctl.is_enabled(unit_name=unit_name) - assert bc_res == sc_res + # For non-existent units systemctl returns 4 since 253 (see https://lwn.net/Articles/923545/) + # bluechictl returns the error code of the sd_bus_call_method call, so the ret codes differ + if unit_exists: + assert bc_res == sc_res + else: + assert bc_res == 1 + assert sc_res == 4 + if check_output: assert bc_out == sc_out @@ -53,7 +61,11 @@ def exec(ctrl: BluechiControllerMachine, nodes: Dict[str, BluechiAgentMachine]): # Error message from bluechictl is not completely the same as from systemctl for non-existent service check_execs( - ctrl=ctrl, node=node_foo, unit_name="non-existent.service", check_output=False + ctrl=ctrl, + node=node_foo, + unit_name="non-existent.service", + unit_exists=False, + check_output=False, ) From 11178491006a7e70f0312b171d142410fc64a3bf Mon Sep 17 00:00:00 2001 From: Michael Engel Date: Tue, 25 Nov 2025 12:58:16 +0100 Subject: [PATCH 3/3] Added const specifier to variable initialization in parse_selinux_type Signed-off-by: Michael Engel --- src/libbluechi/common/parse-util.c | 4 ++-- src/proxy/main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libbluechi/common/parse-util.c b/src/libbluechi/common/parse-util.c index e0b1cbeba7..79d1eb687c 100644 --- a/src/libbluechi/common/parse-util.c +++ b/src/libbluechi/common/parse-util.c @@ -66,7 +66,7 @@ char *parse_selinux_type(const char *context) { /* Format is user:role:type:level */ /* Skip user */ - char *s = strchr(context, ':'); + const char *s = strchr(context, ':'); if (s == NULL) { return NULL; } @@ -85,7 +85,7 @@ char *parse_selinux_type(const char *context) { return NULL; } - char *end = strchr(s, ':'); + const char *end = strchr(s, ':'); if (end == NULL) { return NULL; } diff --git a/src/proxy/main.c b/src/proxy/main.c index b9d893b595..dbb9d2d7bc 100644 --- a/src/proxy/main.c +++ b/src/proxy/main.c @@ -52,7 +52,7 @@ int parse_node_unit_opt(const char *opt_node_unit, char **ret_node_name, char ** return -EINVAL; } - char *split = strchr(opt_node_unit, '_'); + const char *split = strchr(opt_node_unit, '_'); if (split == NULL || split == opt_node_unit) { fprintf(stderr, "No underscore in unit name '%s'\n", opt_node_unit); return -EINVAL;