-
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 integration test tests the Daemond Reload by adding new service that won't start first. After changing the file and by using daemon reload the service will start and will be 'active' Signed-off-by: Artiom Divak <adivak@redhat.com>
- Loading branch information
1 parent
9abb3ca
commit 8938e33
Showing
4 changed files
with
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
summary: Test bluechictl daemon-reload. This test will send an unrunble test will fail at start but then will be change and update with daemon-reload | ||
id: bb9d4394-bd53-4d36-b8ba-ee91697c4850 |
3 changes: 3 additions & 0 deletions
3
tests/tests/tier0/bluechi-daemon-reload/systemd/simple.service
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,3 @@ | ||
[Service] | ||
ExecStart=/s | ||
RemainAfterExit=yes |
43 changes: 43 additions & 0 deletions
43
tests/tests/tier0/bluechi-daemon-reload/test_bluechi_deamon_reload.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,43 @@ | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
|
||
import os | ||
import logging | ||
|
||
from typing import Dict | ||
from bluechi_test.test import BluechiTest | ||
from bluechi_test.machine import BluechiControllerMachine, BluechiAgentMachine | ||
from bluechi_test.config import BluechiControllerConfig, BluechiAgentConfig | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
NODE_FOO = "node-foo" | ||
|
||
|
||
def exec(ctrl: BluechiControllerMachine, nodes: Dict[str, BluechiAgentMachine]): | ||
|
||
node_foo = nodes[NODE_FOO] | ||
service_file = "simple.service" | ||
service_path = os.path.join("/", "etc", "systemd", "system", service_file) | ||
|
||
node_foo.copy_systemd_service(service_file, "systemd", | ||
os.path.join("/", "etc", "systemd", "system")) | ||
ctrl.bluechictl.start_unit(NODE_FOO, service_file) | ||
assert node_foo.wait_for_unit_state_to_be(service_file, "failed") | ||
|
||
node_foo.exec_run(f"sed -i '/ExecStart=/c\\ExecStart=/bin/true' {service_path}") | ||
ctrl.bluechictl.daemon_reload_node(NODE_FOO) | ||
ctrl.bluechictl.start_unit(NODE_FOO, service_file) | ||
assert node_foo.wait_for_unit_state_to_be(service_file, "active") | ||
|
||
|
||
def test_bluechi_deamon_reload( | ||
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 | ||
|
||
bluechi_test.add_bluechi_agent_config(node_foo_cfg) | ||
|
||
bluechi_ctrl_default_config.allowed_node_names = [NODE_FOO] | ||
bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) | ||
|
||
bluechi_test.run(exec) |