-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integration tests: invalid bluechi agent port
This test includes three nodes: bluechi-controller, node-foo, node-bar. - bluechi-controller is the controller node - node-foo will start the agent service with normal configuration using port 8420 - node-bar will try to start the agent service with incorrect port (842O) and should fail (as expected) Signed-off-by: Douglas Schilling Landgraf <[email protected]>
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
tests/tests/tier0/bluechi-agent-invalid-port-configuration/main.fmf
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 @@ | ||
summary: Test if bluechi agent can handle invalid port in the configuration file |
41 changes: 41 additions & 0 deletions
41
...s/tier0/bluechi-agent-invalid-port-configuration/test_agent_invalid_port_configuration.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,41 @@ | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
import pytest | ||
from typing import Dict | ||
|
||
from bluechi_test.test import BluechiTest | ||
from bluechi_test.container import BluechiControllerContainer, BluechiNodeContainer | ||
from bluechi_test.config import BluechiControllerConfig, BluechiNodeConfig | ||
|
||
NODE_FOO = "node-foo" | ||
NODE_BAR = "node-bar" | ||
|
||
|
||
def start_with_invalid_port(ctrl: BluechiControllerContainer, nodes: Dict[str, BluechiNodeContainer]): | ||
result, _ = nodes[NODE_FOO].exec_run('systemctl restart bluechi-agent') | ||
assert result == 0 | ||
|
||
result, _ = nodes[NODE_BAR].exec_run('systemctl restart bluechi-agent') | ||
assert result == 1 | ||
|
||
|
||
@pytest.mark.timeout(60) | ||
def test_agent_invalid_port_configuration( | ||
bluechi_test: BluechiTest, | ||
bluechi_node_default_config: BluechiNodeConfig, bluechi_ctrl_default_config: BluechiControllerConfig): | ||
|
||
node_foo_cfg = bluechi_node_default_config.deep_copy() | ||
node_foo_cfg.node_name = NODE_FOO | ||
node_foo_cfg.manager_port = "8420" | ||
|
||
node_bar_cfg = bluechi_node_default_config.deep_copy() | ||
node_bar_cfg.node_name = NODE_BAR | ||
node_bar_cfg.manager_port = "842O" | ||
|
||
bluechi_ctrl_default_config.allowed_node_names = [NODE_FOO, NODE_BAR] | ||
bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config) | ||
|
||
bluechi_test.add_bluechi_node_config(node_foo_cfg) | ||
bluechi_test.add_bluechi_node_config(node_bar_cfg) | ||
|
||
bluechi_test.run(start_with_invalid_port) |