From e8289a3f83ba4d4edf110bcf838f1c72edb87004 Mon Sep 17 00:00:00 2001 From: Ekaterina Chernitsyna Date: Wed, 25 Oct 2023 14:39:45 +0300 Subject: [PATCH] Update check Policy: REP 1 IN SPB REP 1 IN MSK REP 3 --- pytest_tests/testsuites/container/test_policy.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pytest_tests/testsuites/container/test_policy.py b/pytest_tests/testsuites/container/test_policy.py index b5ed6ba..8989431 100644 --- a/pytest_tests/testsuites/container/test_policy.py +++ b/pytest_tests/testsuites/container/test_policy.py @@ -1460,6 +1460,7 @@ class TestPolicy(ClusterTestBase): This test checks object's copies based on container's placement policy: REP 1 IN SPB REP 1 IN MSK REP 3. """ placement_rule = "REP 1 IN SPB REP 1 IN MSK REP 3 CBF 1 SELECT 2 FROM LED AS SPB SELECT 2 FROM MOW AS MSK FILTER Location EQ 'Saint Petersburg (ex Leningrad)' AS LED FILTER Location EQ Moskva AS MOW" + expected_params = {"location": ["Saint Petersburg (ex Leningrad)", "Moskva"]} file_path = generate_file(simple_object_size.value) expected_copies = 3 endpoint = self.cluster.default_rpc_endpoint @@ -1482,12 +1483,14 @@ class TestPolicy(ClusterTestBase): ), f"Expected {expected_copies} or {expected_copies + 1} copies, got {len(resulting_copies)}" with allure.step(f"Check the object appearance"): - nodes_without_object = get_nodes_without_object( - wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, nodes=self.cluster.storage_nodes - ) - assert set(resulting_copies) | set(nodes_without_object) == set( - self.cluster.storage_nodes - ), f"nodes filling error: nodes with object = {resulting_copies}, nodes witout object = {nodes_without_object}" + netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell)) + netmap = self.get_netmap_param(netmap) + for node in resulting_copies: + node_address = node.get_rpc_endpoint().split(":")[0] + assert expected_params["location"][0] == netmap[node_address]["location"] or ( + expected_params["location"][1] == netmap[node_address]["location"] + ), f"The node is selected from the wrong location. Expected {expected_params} and got {netmap[node_address]}" + self.check_for_the_uniqueness_of_the_nodes(resulting_copies) with allure.step(f"Delete the object from the container"): @@ -1517,5 +1520,6 @@ class TestPolicy(ClusterTestBase): "price": node.price, "continent": node.continent, "un_locode": node.un_locode, + "location": node.location, } return dict_external