Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for disable service in bluechictl #754

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/bluechi_test/bluechictl.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ def enable_unit(self, node_name: str, unit_name: str, check_result: bool = True,
expected_result
)

def disable_unit(self, node_name: str, unit_name: str, check_result: bool = True, expected_result: int = 0) \
-> Tuple[Optional[int], Union[Iterator[bytes], Any, Tuple[bytes, bytes]]]:
return self._run(
f"Disabling unit '{unit_name}' on node '{node_name}'",
f"disable {node_name} {unit_name}",
check_result,
expected_result
)

def freeze_unit(self, node_name: str, unit_name: str, check_result: bool = True, expected_result: int = 0) \
-> Tuple[Optional[int], Union[Iterator[bytes], Any, Tuple[bytes, bytes]]]:
return self._run(
Expand Down
2 changes: 2 additions & 0 deletions tests/tests/tier0/bluechi-enable-disable-service/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
summary: Test if a disabled systemd service can be enabled and then disabled again using bluechictl
id: e3ec3cb3-1010-4205-9b99-507233c6a8f1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def exec(ctrl: BluechiControllerMachine, nodes: Dict[str, BluechiAgentMachine]):
if not foo.systemctl.is_unit_enabled(simple_service, check_result=False):
raise Exception(f"Unit {simple_service} expected to be enabled, but is not")

ctrl.bluechictl.disable_unit(node_foo_name, simple_service)

if not foo.systemctl.is_unit_disabled(simple_service, check_result=False):
raise Exception(f"Unit {simple_service} expected to be disabled, but is not")


def test_proxy_service_start(
bluechi_test: BluechiTest,
Expand Down
2 changes: 0 additions & 2 deletions tests/tests/tier0/bluechi-enable-service/main.fmf

This file was deleted.

Loading