From 6ee9b70d50620323dbdf695b384e6b474e368b91 Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Fri, 15 Dec 2023 13:10:01 +0300 Subject: [PATCH] [#175] Update maintenance steps Signed-off-by: Dmitriy Zayakin --- .../management/test_node_management.py | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/pytest_tests/testsuites/management/test_node_management.py b/pytest_tests/testsuites/management/test_node_management.py index 4a82e207..8c7a635f 100644 --- a/pytest_tests/testsuites/management/test_node_management.py +++ b/pytest_tests/testsuites/management/test_node_management.py @@ -471,7 +471,7 @@ class TestMaintenanceMode(ClusterTestBase): netmap = NetmapParser.snapshot_all_nodes(netmap) assert node_under_test.host_ip not in [ netmap_node.node for netmap_node in netmap - ], f"Node {node_under_test.host_ip} not in state offline" + ], f"Node {node_under_test.host_ip} not in state offline. netmap - {netmap}" with reporter.step("Restart storage service"): cluster_state_controller.stop_storage_service(node_under_test) @@ -484,10 +484,10 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.ONLINE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.ONLINE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert ( + node.node_status == ModeNode.ONLINE.value.upper() + ), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Tick epoch"): self.tick_epochs(epochs_to_tick=2, alive_node=cluster_nodes[0].storage_node, wait_block=2) @@ -507,10 +507,8 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.MAINTENANCE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.MAINTENANCE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert node == ModeNode.MAINTENANCE.value.upper(), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Tick epoch"): self.tick_epochs(epochs_to_tick=2, alive_node=cluster_nodes[0].storage_node, wait_block=2) @@ -519,10 +517,10 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.OFFLINE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.OFFLINE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert ( + node.node_status == ModeNode.OFFLINE.value.upper() + ), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Stop storage service"): cluster_state_controller.stop_storage_service(node_under_test) @@ -537,10 +535,8 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.OFFLINE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.OFFLINE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert node == ModeNode.OFFLINE.value.upper(), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Tick epoch"): self.tick_epochs(epochs_to_tick=2, alive_node=cluster_nodes[0].storage_node, wait_block=2) @@ -549,10 +545,10 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.ONLINE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.ONLINE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert ( + node.node_status == ModeNode.ONLINE.value.upper() + ), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Tick epoch"): self.tick_epochs(epochs_to_tick=2, alive_node=cluster_nodes[0].storage_node, wait_block=2) @@ -575,11 +571,10 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - + node = NetmapParser.snapshot_one_node(netmap, node_under_test) assert ( - node_state == ModeNode.MAINTENANCE.value.upper() - ), f"Node actual state - {node_state}, expect - {ModeNode.MAINTENANCE.value}" + node.node_status == ModeNode.MAINTENANCE.value.upper() + ), f"{node_under_test} actual state in netmap - {netmap}" with reporter.step("Tick epoch"): self.tick_epochs(epochs_to_tick=2, alive_node=cluster_nodes[0].storage_node, wait_block=2) @@ -588,10 +583,10 @@ class TestMaintenanceMode(ClusterTestBase): netmap = frostfs_cli.netmap.snapshot( rpc_endpoint=cluster_nodes[0].storage_node.get_rpc_endpoint(), wallet=default_wallet ).stdout - node_state = NetmapParser.snapshot_one_node(netmap, node_under_test).node_status - assert node_state == ModeNode.MAINTENANCE.value.upper(), ( - f"Node actual state - {node_state}, " f"expect - {ModeNode.MAINTENANCE.value}" - ) + node = NetmapParser.snapshot_one_node(netmap, node_under_test) + assert ( + node.node_status == ModeNode.MAINTENANCE.value.upper() + ), f"{node_under_test} actual state in netmap - {netmap}" @allure.title("A node cannot go into maintenance if maintenance is prohibited globally in the network") def test_maintenance_globally_forbidden(