Skip to content

Commit 3eb5af0

Browse files
committed
Fixed race condition in agent invalid port config integration test
Signed-off-by: Michael Engel <mengel@redhat.com>
1 parent 735ac75 commit 3eb5af0

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

tests/tests/tier0/bluechi-agent-invalid-port-configuration/test_agent_invalid_port_configuration.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,26 @@
1010
from bluechi_test.test import BluechiTest
1111

1212
NODE_FOO = "node-foo"
13-
NODE_BAR = "node-bar"
1413

1514

1615
def start_with_invalid_port(
1716
ctrl: BluechiControllerMachine, nodes: Dict[str, BluechiAgentMachine]
1817
):
19-
node_foo_with_valid_port = nodes[NODE_FOO]
20-
assert node_foo_with_valid_port.wait_for_unit_state_to_be("bluechi-agent", "active")
21-
22-
node_bar_with_invalid_port = nodes[NODE_BAR]
23-
assert node_bar_with_invalid_port.wait_for_unit_state_to_be(
24-
"bluechi-agent", "failed"
18+
node_foo = nodes[NODE_FOO]
19+
assert node_foo.wait_for_unit_state_to_be("bluechi-agent", "active")
20+
21+
# Use letter O instead of number 0 in controller port string
22+
# to mimic a typo
23+
node_foo.config.controller_port = "842O"
24+
node_foo.create_file(
25+
node_foo.config.get_confd_dir(),
26+
node_foo.config.file_name,
27+
node_foo.config.serialize(),
2528
)
2629

30+
node_foo.systemctl.restart_unit("bluechi-agent.service")
31+
assert node_foo.wait_for_unit_state_to_be("bluechi-agent", "failed")
32+
2733

2834
def test_agent_invalid_port_configuration(
2935
bluechi_test: BluechiTest,
@@ -35,14 +41,9 @@ def test_agent_invalid_port_configuration(
3541
node_foo_cfg.node_name = NODE_FOO
3642
node_foo_cfg.controller_port = "8420"
3743

38-
node_bar_cfg = bluechi_node_default_config.deep_copy()
39-
node_bar_cfg.node_name = NODE_BAR
40-
node_bar_cfg.controller_port = "842O"
41-
42-
bluechi_ctrl_default_config.allowed_node_names = [NODE_FOO, NODE_BAR]
44+
bluechi_ctrl_default_config.allowed_node_names = [NODE_FOO]
4345
bluechi_test.set_bluechi_controller_config(bluechi_ctrl_default_config)
4446

4547
bluechi_test.add_bluechi_agent_config(node_foo_cfg)
46-
bluechi_test.add_bluechi_agent_config(node_bar_cfg)
4748

4849
bluechi_test.run(start_with_invalid_port)

0 commit comments

Comments
 (0)