From 2564f7421eadae31e9a57c53015b661383591876 Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Thu, 19 Oct 2023 10:38:42 +0300 Subject: [PATCH] Add test down all data interfaces Signed-off-by: Dmitriy Zayakin --- .../replication/test_replication.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pytest_tests/testsuites/replication/test_replication.py b/pytest_tests/testsuites/replication/test_replication.py index 58dd5154..ee155b84 100644 --- a/pytest_tests/testsuites/replication/test_replication.py +++ b/pytest_tests/testsuites/replication/test_replication.py @@ -11,6 +11,7 @@ from frostfs_testlib.storage.cluster import Cluster from frostfs_testlib.storage.controllers.cluster_state_controller import ClusterStateController from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.testing.cluster_test_base import ClusterTestBase +from frostfs_testlib.utils.failover_utils import wait_object_replication from frostfs_testlib.utils.file_utils import generate_file logger = logging.getLogger("NeoLogger") @@ -63,32 +64,38 @@ class TestReplication(ClusterTestBase): attributes=OBJECT_ATTRIBUTES, copies_number=3, endpoint=random.choice(alive_nodes).storage_node.get_rpc_endpoint(), + timeout="45s", ) cluster_state_controller.start_node_host(node_for_rep) - with allure.step(f"Wait for replication. Sleep {WAIT_FOR_REPLICATION}s"): - sleep(WAIT_FOR_REPLICATION) + with allure.step(f"Wait for replication."): + object_nodes = wait_object_replication( + cid=cid, + oid=oid, + expected_copies=len(self.cluster.cluster_nodes), + shell=client_shell, + nodes=self.cluster.storage_nodes, + ) - for node in cluster.cluster_nodes: - with allure.step(f"Check object on node {node}"): + with allure.step("Check attributes"): + for node in object_nodes: header_info = head_object( wallet=default_wallet, oid=oid, cid=cid, shell=self.shell, - endpoint=node.storage_node.get_rpc_endpoint(), + endpoint=node.get_rpc_endpoint(), is_direct=True, )["header"] attributes = header_info["attributes"] for attribute_key, attribute_value in OBJECT_ATTRIBUTES.items(): - assert ( - attribute_key in attributes - ), f"{attribute_key} not found in {header_info}" + assert attribute_key in attributes, f"{attribute_key} not found in {header_info}" assert header_info["attributes"].get(attribute_key) == str(attribute_value), ( f"{attribute_key} value not equal: " f"got attribute value: {attributes.get(attribute_key)}" f"expected attribute value: {attribute_value}" ) + with allure.step("Cleanup"): delete_object( wallet=default_wallet,