-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR will add bluechi the ability to reset failed all units or reset one failed unit. Solves: #932 Signed-off-by: Artiom Divak <adivak@redhat.com>
- Loading branch information
1 parent
a890cbb
commit 0184664
Showing
17 changed files
with
381 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
summary: Test resetting the failed state of all units on a node via D-Bus API call. | ||
id: fc5db6a7-1367-450b-b674-35b9541d4f3e |
61 changes: 61 additions & 0 deletions
61
tests/tests/tier0/bluechi-reset-failed-node/test_bluechi_reset_failed_node.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# | ||
# Copyright Contributors to the Eclipse BlueChi project | ||
# | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
import logging | ||
from typing import Dict | ||
|
||
from bluechi_test.config import BluechiAgentConfig, BluechiControllerConfig | ||
from bluechi_test.machine import BluechiAgentMachine, BluechiControllerMachine | ||
from bluechi_test.service import Option, Section, SimpleRemainingService | ||
from bluechi_test.test import BluechiTest | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
NODE_FOO = "node-foo" | ||
NODE_BAR = "node-bar" | ||
|
||
|
||
def exec(ctrl: BluechiControllerMachine, nodes: Dict[str, BluechiAgentMachine]): | ||
|
||
node_foo = nodes[NODE_FOO] | ||
node_bar = nodes[NODE_BAR] | ||
|
||
failed_service_node_bar = SimpleRemainingService(name="simple.service") | ||
failed_service_node_bar.set_option(Section.Service, Option.ExecStart, "/s") | ||
failed_service_node_foo = SimpleRemainingService(name="simple.service") | ||
failed_service_node_foo.set_option(Section.Service, Option.ExecStart, "/s") | ||
|
||
node_foo.install_systemd_service(failed_service_node_bar) | ||
node_bar.install_systemd_service(failed_service_node_foo) | ||
|
||
ctrl.bluechictl.start_unit(NODE_FOO, failed_service_node_foo.name) | ||
ctrl.bluechictl.start_unit(NODE_BAR, failed_service_node_bar.name) | ||
|
||
assert node_foo.wait_for_unit_state_to_be(failed_service_node_foo.name, "failed") | ||
assert node_bar.wait_for_unit_state_to_be(failed_service_node_bar.name, "failed") | ||
|
||
ctrl.bluechictl.reset_failed(node_name=NODE_FOO) | ||
|
||
assert node_foo.wait_for_unit_state_to_be(failed_service_node_foo.name, "inactive") | ||
assert node_bar.wait_for_unit_state_to_be(failed_service_node_bar.name, "failed") | ||
|
||
|
||
def test_bluechi_reset_failed_node( | ||
bluechi_test: BluechiTest, | ||
bluechi_node_default_config: BluechiAgentConfig, | ||
bluechi_ctrl_default_config: BluechiControllerConfig, | ||
): | ||
node_foo_cfg = bluechi_node_default_config.deep_copy() | ||
node_foo_cfg.node_name = NODE_FOO | ||
|
||
node_bar_cfg = bluechi_node_default_config.deep_copy() | ||
node_bar_cfg.node_name = NODE_BAR | ||
|
||
bluechi_test.add_bluechi_agent_config(node_foo_cfg) | ||
bluechi_test.add_bluechi_agent_config(node_bar_cfg) | ||
|
||
bluechi_ctrl_default_config.allowed_node_names = [NODE_FOO, NODE_BAR] | ||
bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) | ||
|
||
bluechi_test.run(exec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
summary: Test resetting the failed state of a specific on a node via D-Bus API call. | ||
id: 6c67e96d-db4b-4a54-980c-287e33450abf |
Oops, something went wrong.