Update check filters results with 25% node the object appearance

This commit is contained in:
Ekaterina Chernitsyna 2023-10-25 14:33:23 +03:00
parent eee02d1346
commit 00f312dab9

View file

@ -445,6 +445,7 @@ class TestPolicy(ClusterTestBase):
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 25% of available nodes. This test checks object's copies based on container's placement policy with SELECT and FILTER results with 25% of available nodes.
""" """
placement_rule = "REP 1 IN Nodes25 SELECT 1 FROM LE10 AS Nodes25 FILTER Price LE 10 AS LE10" placement_rule = "REP 1 IN Nodes25 SELECT 1 FROM LE10 AS Nodes25 FILTER Price LE 10 AS LE10"
expected_params = {"price": 10}
file_path = generate_file(simple_object_size.value) file_path = generate_file(simple_object_size.value)
expected_copies = 1 expected_copies = 1
endpoint = self.cluster.default_rpc_endpoint endpoint = self.cluster.default_rpc_endpoint
@ -467,9 +468,13 @@ class TestPolicy(ClusterTestBase):
), f"Expected {expected_copies} copies, got {len(resulting_copies)}" ), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"): with allure.step(f"Check the object appearance"):
nodes_without_object = get_nodes_without_object( netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, nodes=self.cluster.storage_nodes netmap = self.get_netmap_param(netmap)
) for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
int(netmap[node_address]["price"]) <= expected_params["price"]
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
with allure.step(f"Delete the object from the container"): with allure.step(f"Delete the object from the container"):
delete_object(wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, endpoint=endpoint) delete_object(wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, endpoint=endpoint)
@ -488,6 +493,7 @@ class TestPolicy(ClusterTestBase):
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 25% of available nodes. This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 25% of available nodes.
""" """
placement_rule = "REP 1 IN Nodes25 SELECT 1 FROM BET0AND10 AS Nodes25 FILTER Price LE 10 AS LE10 FILTER Price GT 0 AS GT0 FILTER @LE10 AND @GT0 AS BET0AND10" placement_rule = "REP 1 IN Nodes25 SELECT 1 FROM BET0AND10 AS Nodes25 FILTER Price LE 10 AS LE10 FILTER Price GT 0 AS GT0 FILTER @LE10 AND @GT0 AS BET0AND10"
expected_params = {"price": [10, 0]}
file_path = generate_file(simple_object_size.value) file_path = generate_file(simple_object_size.value)
expected_copies = 1 expected_copies = 1
endpoint = self.cluster.default_rpc_endpoint endpoint = self.cluster.default_rpc_endpoint
@ -510,9 +516,18 @@ class TestPolicy(ClusterTestBase):
), f"Expected {expected_copies} copies, got {len(resulting_copies)}" ), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"): with allure.step(f"Check the object appearance"):
nodes_without_object = get_nodes_without_object( netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, nodes=self.cluster.storage_nodes netmap = self.get_netmap_param(netmap)
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
int(netmap[node_address]["price"]) > expected_params["price"][1]
or int(netmap[node_address]["price"]) <= expected_params["price"][0]
or (
int(netmap[node_address]["price"]) > expected_params["price"][1]
and int(netmap[node_address]["price"]) <= expected_params["price"][0]
) )
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
with allure.step(f"Delete the object from the container"): with allure.step(f"Delete the object from the container"):
delete_object(wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, endpoint=endpoint) delete_object(wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, endpoint=endpoint)
@ -531,6 +546,7 @@ class TestPolicy(ClusterTestBase):
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 25% of available nodes. This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 25% of available nodes.
""" """
placement_rule = "UNIQUE REP 1 IN One REP 1 IN One CBF 1 SELECT 1 FROM MINMAX AS One FILTER Price LT 15 AS LT15 FILTER Price GT 55 AS GT55 FILTER @LT15 OR @GT55 AS MINMAX" placement_rule = "UNIQUE REP 1 IN One REP 1 IN One CBF 1 SELECT 1 FROM MINMAX AS One FILTER Price LT 15 AS LT15 FILTER Price GT 55 AS GT55 FILTER @LT15 OR @GT55 AS MINMAX"
expected_params = {"price": [15, 55]}
file_path = generate_file(simple_object_size.value) file_path = generate_file(simple_object_size.value)
expected_copies = 2 expected_copies = 2
endpoint = self.cluster.default_rpc_endpoint endpoint = self.cluster.default_rpc_endpoint
@ -553,9 +569,18 @@ class TestPolicy(ClusterTestBase):
), f"Expected {expected_copies} copies, got {len(resulting_copies)}" ), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"): with allure.step(f"Check the object appearance"):
nodes_without_object = get_nodes_without_object( netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, nodes=self.cluster.storage_nodes netmap = self.get_netmap_param(netmap)
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
int(netmap[node_address]["price"]) > expected_params["price"][1]
or int(netmap[node_address]["price"]) < expected_params["price"][0]
or (
int(netmap[node_address]["price"]) > expected_params["price"][1]
or int(netmap[node_address]["price"]) < expected_params["price"][0]
) )
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
self.check_for_the_uniqueness_of_the_nodes(resulting_copies) self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
with allure.step(f"Delete the object from the container"): with allure.step(f"Delete the object from the container"):