update-allure-title #164
1 changed files with 167 additions and 176 deletions
|
@ -181,7 +181,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
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
|
||||||
expected_params = {"country": "Russia"}
|
placement_params = {"country": "Russia"}
|
||||||
|
|
||||||
with allure.step(f"Create container with policy {placement_rule}"):
|
with allure.step(f"Create container with policy {placement_rule}"):
|
||||||
cid = create_container(
|
cid = create_container(
|
||||||
|
@ -204,9 +204,10 @@ class TestPolicy(ClusterTestBase):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
||||||
assert (
|
with allure.step(f"Check the node is selected from {placement_params['country']}"):
|
||||||
expected_params["country"] == netmap[node_address]["country"]
|
assert (
|
||||||
), f"The node is selected from the wrong country. Expected {expected_params['country']} and got {netmap[node_address]['country']}"
|
placement_params["country"] == netmap[node_address]["country"]
|
||||||
|
), f"The node is selected from the wrong country. 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)
|
||||||
|
@ -224,8 +225,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with one node.
|
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with one node.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 1 IN RUS REP 1 IN RUS CBF 1 SELECT 1 FROM RU AS RUS FILTER Country NE Sweden AS NotSE FILTER @NotSE AND NOT (CountryCode EQ FI) AND Country EQ 'Russia' AS RU"
|
placement_rule = "REP 1 IN RUS REP 1 IN RUS CBF 1 SELECT 1 FROM RU AS RUS FILTER Country NE Sweden AS NotSE FILTER @NotSE AND NOT (CountryCode EQ FI) AND Country EQ 'Russia' AS RU"
|
||||||
expected_params = {"country": ["Russia", "Sweden"]}
|
placement_params = {"country": ["Russia", "Sweden"], "country_code": "FI"}
|
||||||
unexpected_params = {"country": "Sweden", "country_code": "FI"}
|
|
||||||
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
|
||||||
|
@ -251,12 +251,15 @@ class TestPolicy(ClusterTestBase):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
||||||
assert (
|
with allure.step(
|
||||||
(expected_params["country"][1] == netmap[node_address]["country"])
|
f"Check the node is selected from {placement_params['country'][0]}"
|
||||||
or not (unexpected_params["country"] == netmap[node_address]["country"])
|
):
|
||||||
and not (unexpected_params["country_code"] == netmap[node_address]["country_code"])
|
assert (
|
||||||
and (expected_params["country"][0] == netmap[node_address]["country"])
|
not (placement_params["country"][1] == netmap[node_address]["country"])
|
||||||
), f"The node is selected from the wrong country or country code. Expected {expected_params} and got {netmap[node_address]}"
|
or not (placement_params["country"][1] == netmap[node_address]["country"])
|
||||||
|
and not (placement_params["country_code"] == netmap[node_address]["country_code"])
|
||||||
|
and (placement_params["country"][0] == netmap[node_address]["country"])
|
||||||
|
), f"The node is selected from the wrong country or country code. 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)
|
||||||
|
@ -275,8 +278,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with one nodes.
|
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with one nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 1 IN RU REP 1 IN EU REP 1 IN RU CBF 1 SELECT 1 FROM RUS AS RU SELECT 1 FROM EUR AS EU FILTER Country EQ Russia AS RUS FILTER NOT (@RUS) AND Country EQ Sweden OR CountryCode EQ FI AS EUR"
|
placement_rule = "REP 1 IN RU REP 1 IN EU REP 1 IN RU CBF 1 SELECT 1 FROM RUS AS RU SELECT 1 FROM EUR AS EU FILTER Country EQ Russia AS RUS FILTER NOT (@RUS) AND Country EQ Sweden OR CountryCode EQ FI AS EUR"
|
||||||
expected_params = {"country": ["Sweden", "Russia"], "country_code": "FI"}
|
placement_params = {"country": ["Sweden", "Russia"], "country_code": "FI"}
|
||||||
unexpected_params = {"country": "Russia"}
|
|
||||||
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
|
||||||
|
@ -301,13 +303,14 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected from any country"):
|
||||||
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (expected_params["country"][1] == netmap[node_address]["country"]) or (
|
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
||||||
not (unexpected_params["country"][1] == netmap[node_address]["country"])
|
assert (placement_params["country"][1] == netmap[node_address]["country"]) or (
|
||||||
and (expected_params["country"][0] == netmap[node_address]["country"])
|
not (placement_params["country"][1] == netmap[node_address]["country"])
|
||||||
or (expected_params["country_code"] == netmap[node_address]["country_code"])
|
and (placement_params["country"][0] == netmap[node_address]["country"])
|
||||||
), f"The node is selected from the wrong country or country code. Expected {expected_params} and got {netmap[node_address]}"
|
or (placement_params["country_code"] == netmap[node_address]["country_code"])
|
||||||
|
), f"The node is selected from the wrong country or country code. 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)
|
||||||
|
@ -326,11 +329,11 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and FILTER results with UNIQUE nodes.
|
This test checks object's copies based on container's placement policy with SELECT and FILTER results with UNIQUE nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "UNIQUE REP 1 IN MyRussianNodes REP 1 IN MyRussianNodes CBF 1 SELECT 1 FROM RussianNodes AS MyRussianNodes FILTER Country EQ 'Russia' AS RussianNodes"
|
placement_rule = "UNIQUE REP 1 IN MyRussianNodes REP 1 IN MyRussianNodes CBF 1 SELECT 1 FROM RussianNodes AS MyRussianNodes FILTER Country EQ 'Russia' AS RussianNodes"
|
||||||
|
placement_params = {"country": "Russia"}
|
||||||
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
|
||||||
expected_params = {"country": "Russia"}
|
|
||||||
|
|
||||||
with allure.step(f"Create container with policy {placement_rule}"):
|
with allure.step(f"Create container with policy {placement_rule}"):
|
||||||
cid = create_container(
|
cid = create_container(
|
||||||
wallet=default_wallet, rule=placement_rule, basic_acl=PUBLIC_ACL, shell=self.shell, endpoint=endpoint
|
wallet=default_wallet, rule=placement_rule, basic_acl=PUBLIC_ACL, shell=self.shell, endpoint=endpoint
|
||||||
|
@ -349,14 +352,14 @@ 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"):
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected from {placement_params['country']}"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
expected_params["country"] == netmap[node_address]["country"]
|
assert (
|
||||||
), f"The node is selected from the wrong country. Expected {expected_params['country']} and got {netmap[node_address]['country']}"
|
placement_params["country"] == netmap[node_address]["country"]
|
||||||
|
), f"The node is selected from the wrong country. Got {netmap[node_address]['country']}"
|
||||||
|
|
||||||
with allure.step(f"Delete the container"):
|
with allure.step(f"Delete the container"):
|
||||||
delete_container(wallet=default_wallet, cid=cid, shell=self.shell, endpoint=endpoint)
|
delete_container(wallet=default_wallet, cid=cid, shell=self.shell, endpoint=endpoint)
|
||||||
|
@ -449,7 +452,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}
|
placement_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
|
||||||
|
@ -474,11 +477,11 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
with allure.step(f"Check the node is selected with price <= {placement_params['price']}"):
|
||||||
assert (
|
assert (
|
||||||
int(netmap[node_address]["price"]) <= expected_params["price"]
|
int(netmap[node_address]["price"]) <= placement_params["price"]
|
||||||
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
|
), f"The node is selected with the wrong price. 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)
|
||||||
|
@ -497,7 +500,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]}
|
placement_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
|
||||||
|
@ -522,16 +525,13 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check the node is selected with price between 1 and 10"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"][1]
|
assert (
|
||||||
or int(netmap[node_address]["price"]) <= expected_params["price"][0]
|
int(netmap[node_address]["price"]) > placement_params["price"][1]
|
||||||
or (
|
and int(netmap[node_address]["price"]) <= placement_params["price"][0]
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"][1]
|
), f"The node is selected with the wrong price. Got {netmap[node_address]}"
|
||||||
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)
|
||||||
|
@ -550,7 +550,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]}
|
placement_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
|
||||||
|
@ -575,17 +575,13 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected with max and min prices"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"][1]
|
assert (
|
||||||
or int(netmap[node_address]["price"]) < expected_params["price"][0]
|
int(netmap[node_address]["price"]) > placement_params["price"][1]
|
||||||
or (
|
or int(netmap[node_address]["price"]) < placement_params["price"][0]
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"][1]
|
), f"The node is selected with the wrong price. Got {netmap[node_address]}"
|
||||||
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)
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -678,7 +674,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 50% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 50% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN HALF CBF 1 SELECT 2 FROM GT15 AS HALF FILTER Price GT 15 AS GT15"
|
placement_rule = "REP 2 IN HALF CBF 1 SELECT 2 FROM GT15 AS HALF FILTER Price GT 15 AS GT15"
|
||||||
expected_params = {"price": 15}
|
placement_params = {"price": 15}
|
||||||
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
|
||||||
|
@ -703,11 +699,12 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected with price > {placement_params['price']}"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"]
|
assert (
|
||||||
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
|
int(netmap[node_address]["price"]) > placement_params["price"]
|
||||||
|
), f"The node is selected with the wrong price. 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)
|
||||||
|
@ -726,8 +723,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 50% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 50% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN HALF CBF 2 SELECT 2 FROM GE15 AS HALF FILTER CountryCode NE RU AS NOTRU FILTER @NOTRU AND Price GE 15 AS GE15"
|
placement_rule = "REP 2 IN HALF CBF 2 SELECT 2 FROM GE15 AS HALF FILTER CountryCode NE RU AS NOTRU FILTER @NOTRU AND Price GE 15 AS GE15"
|
||||||
expected_params = {"price": 15}
|
placement_params = {"price": 15, "country_code": "RU"}
|
||||||
unexpected_params = {"country_code": "RU"}
|
|
||||||
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
|
||||||
|
@ -752,12 +748,13 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected not with country code '{placement_params['country_code']}'"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (not netmap[node_address]["country_code"] == unexpected_params["country_code"]) or (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
not netmap[node_address]["country_code"] == unexpected_params["country_code"]
|
assert (not netmap[node_address]["country_code"] == placement_params["country_code"]
|
||||||
and int(netmap[node_address]["price"]) >= expected_params["price"]
|
or not netmap[node_address]["country_code"] == placement_params["country_code"]
|
||||||
), f"The node is selected from the wrong price or country_code. Expected {expected_params} and got {netmap[node_address]}"
|
and int(netmap[node_address]["price"]) >= placement_params["price"]
|
||||||
|
), f"The node is selected with the wrong price or country code. 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)
|
||||||
|
@ -776,7 +773,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 50% of available nodes.
|
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 50% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN FH REP 1 IN SH CBF 2 SELECT 2 FROM LE55 AS FH SELECT 2 FROM GE15 AS SH FILTER 'UN-LOCODE' EQ RU_LED OR 'UN-LOCODE' EQ RU_MOW AS RU FILTER NOT(@RU) AS NOTRU FILTER @NOTRU AND Price GE 15 AS GE15 FILTER @RU AND Price LE 55 AS LE55"
|
placement_rule = "REP 2 IN FH REP 1 IN SH CBF 2 SELECT 2 FROM LE55 AS FH SELECT 2 FROM GE15 AS SH FILTER 'UN-LOCODE' EQ RU_LED OR 'UN-LOCODE' EQ RU_MOW AS RU FILTER NOT(@RU) AS NOTRU FILTER @NOTRU AND Price GE 15 AS GE15 FILTER @RU AND Price LE 55 AS LE55"
|
||||||
expected_params = {"un_locode": ["RU_LED", "RU_MOW"], "price": [15, 55]}
|
placement_params = {"un_locode": ["RU_LED", "RU_MOW"], "price": [15, 55]}
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 4
|
expected_copies = 4
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -801,20 +798,21 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check all nodes are selected"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
(netmap[node_address]["un_locode"] in expected_params["un_locode"])
|
assert (
|
||||||
or (not netmap[node_address]["un_locode"] in expected_params["un_locode"])
|
netmap[node_address]["un_locode"] in placement_params["un_locode"]
|
||||||
or (
|
or not netmap[node_address]["un_locode"] == placement_params["un_locode"][1]
|
||||||
not netmap[node_address]["un_locode"] in expected_params["un_locode"]
|
or (
|
||||||
and int(netmap[node_address]["price"]) >= expected_params["price"][0]
|
not netmap[node_address]["un_locode"] == placement_params["un_locode"][1]
|
||||||
)
|
and int(netmap[node_address]["price"]) >= placement_params["price"][0]
|
||||||
or (
|
)
|
||||||
netmap[node_address]["un_locode"] in expected_params["un_locode"]
|
or (
|
||||||
and int(netmap[node_address]["price"]) <= expected_params["price"][1]
|
netmap[node_address]["un_locode"] == placement_params["un_locode"][1]
|
||||||
)
|
and int(netmap[node_address]["price"]) <= placement_params["price"][1]
|
||||||
), f"The node is selected from the wrong price or un_locode. Expected {expected_params} and got {netmap[node_address]}"
|
)
|
||||||
|
), f"The node is selected with the wrong price or un_locode. Expected {placement_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)
|
||||||
|
@ -908,7 +906,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 75% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 75% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN NODES75 SELECT 2 FROM LT65 AS NODES75 FILTER Price LT 65 AS LT65"
|
placement_rule = "REP 2 IN NODES75 SELECT 2 FROM LT65 AS NODES75 FILTER Price LT 65 AS LT65"
|
||||||
expected_params = {"price": 65}
|
placement_params = {"price": 65}
|
||||||
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
|
||||||
|
@ -933,11 +931,12 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected with price < {placement_params['price']}"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
int(netmap[node_address]["price"]) < expected_params["price"]
|
assert (
|
||||||
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
|
int(netmap[node_address]["price"]) < placement_params["price"]
|
||||||
|
), f"The node is selected with the wrong price. 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)
|
||||||
|
@ -956,8 +955,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 75% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 75% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN NODES75 SELECT 2 FROM LT65 AS NODES75 FILTER Continent NE America AS NOAM FILTER @NOAM AND Price LT 65 AS LT65"
|
placement_rule = "REP 2 IN NODES75 SELECT 2 FROM LT65 AS NODES75 FILTER Continent NE America AS NOAM FILTER @NOAM AND Price LT 65 AS LT65"
|
||||||
expected_params = {"price": 65}
|
placement_params = {"price": 65, "continent": "America"}
|
||||||
unexpected_params = {"continent": "America"}
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 3
|
expected_copies = 3
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -982,14 +980,16 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check three nodes are selected not from {placement_params['continent']}"
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
):
|
||||||
assert (
|
for node in resulting_copies:
|
||||||
int(netmap[node_address]["price"]) < expected_params["price"]
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
and netmap[node_address]["continent"] == unexpected_params["continent"]
|
assert (
|
||||||
) or (
|
int(netmap[node_address]["price"]) < placement_params["price"]
|
||||||
netmap[node_address]["continent"] == unexpected_params["continent"]
|
and not netmap[node_address]["continent"] == placement_params["continent"]
|
||||||
), f"The node is selected from the wrong price or continent. Expected {expected_params} and got {netmap[node_address]}"
|
) or (
|
||||||
|
not netmap[node_address]["continent"] == placement_params["continent"]
|
||||||
|
), f"The node is selected with the wrong price or continent. 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)
|
||||||
|
@ -1008,8 +1008,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 75% of available nodes.
|
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 75% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN EXPNSV REP 2 IN CHEAP SELECT 3 FROM GT10 AS EXPNSV SELECT 3 FROM LT65 AS CHEAP FILTER NOT(Continent EQ America) AS NOAM FILTER @NOAM AND Price LT 65 AS LT65 FILTER @NOAM AND Price GT 10 AS GT10"
|
placement_rule = "REP 2 IN EXPNSV REP 2 IN CHEAP SELECT 3 FROM GT10 AS EXPNSV SELECT 3 FROM LT65 AS CHEAP FILTER NOT(Continent EQ America) AS NOAM FILTER @NOAM AND Price LT 65 AS LT65 FILTER @NOAM AND Price GT 10 AS GT10"
|
||||||
expected_params = {"price": [65, 10]}
|
placement_params = {"price": [65, 10], "continent": "America"}
|
||||||
unexpected_params = {"continent": "America"}
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 4
|
expected_copies = 4
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -1034,19 +1033,20 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check all nodes are selected"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
(
|
assert (
|
||||||
int(netmap[node_address]["price"]) > expected_params["price"][1]
|
(
|
||||||
and netmap[node_address]["continent"] == unexpected_params["continent"]
|
int(netmap[node_address]["price"]) > placement_params["price"][1]
|
||||||
)
|
and not netmap[node_address]["continent"] == placement_params["continent"]
|
||||||
or (
|
)
|
||||||
int(netmap[node_address]["price"]) < expected_params["price"][0]
|
or (
|
||||||
and netmap[node_address]["continent"] == unexpected_params["continent"]
|
int(netmap[node_address]["price"]) < placement_params["price"][0]
|
||||||
)
|
and not netmap[node_address]["continent"] == placement_params["continent"]
|
||||||
or (netmap[node_address]["continent"] == unexpected_params["continent"])
|
)
|
||||||
), f"The node is selected from the wrong price or continent. Expected {expected_params} and got {netmap[node_address]}"
|
or not (netmap[node_address]["continent"] == placement_params["continent"])
|
||||||
|
), f"The node is selected with the wrong price or continent. 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)
|
||||||
|
@ -1140,7 +1140,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 100% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and FILTER results with 100% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 1 IN All SELECT 4 FROM AllNodes AS All FILTER Price GE 0 AS AllNodes"
|
placement_rule = "REP 1 IN All SELECT 4 FROM AllNodes AS All FILTER Price GE 0 AS AllNodes"
|
||||||
expected_params = {"price": 0}
|
placement_params = {"price": 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
|
||||||
|
@ -1163,13 +1163,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"):
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
|
||||||
assert netmap[node_address]["price"] >= int(
|
with allure.step(f"Check the node is selected with price >= {placement_params['price']}"):
|
||||||
expected_params["price"]
|
assert (
|
||||||
), f"The node is selected from the wrong price. Expected {expected_params} and got {netmap[node_address]}"
|
netmap[node_address]["price"] >= int(placement_params["price"])
|
||||||
|
), f"The node is selected with the wrong price. 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)
|
||||||
|
@ -1187,7 +1187,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 100% of available nodes.
|
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with 100% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 2 IN All SELECT 4 FROM AllNodes AS All FILTER Country EQ Russia OR Country EQ Sweden OR Country EQ Finland AS AllCountries FILTER @AllCountries AND Continent EQ Europe AS AllNodes"
|
placement_rule = "REP 2 IN All SELECT 4 FROM AllNodes AS All FILTER Country EQ Russia OR Country EQ Sweden OR Country EQ Finland AS AllCountries FILTER @AllCountries AND Continent EQ Europe AS AllNodes"
|
||||||
expected_params = {"country": ["Russia", "Sweden", "Finland"], "continent": "Europe"}
|
placement_params = {"country": ["Russia", "Sweden", "Finland"], "continent": "Europe"}
|
||||||
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
|
||||||
|
@ -1212,13 +1212,14 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected from {' or '.join(placement_params['country'])}"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
(netmap[node_address]["country"] in expected_params["country"])
|
assert (
|
||||||
or (netmap[node_address]["country"] in expected_params["country"])
|
(netmap[node_address]["country"] in placement_params["country"])
|
||||||
and (netmap[node_address]["continent"] in expected_params["continent"])
|
or (netmap[node_address]["country"] in placement_params["country"])
|
||||||
), f"The node is selected from the wrong country or continent. Expected {expected_params} and got {netmap[node_address]}"
|
and (netmap[node_address]["continent"] == placement_params["continent"])
|
||||||
|
), f"The node is selected from the wrong country or continent. 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)
|
||||||
|
@ -1236,7 +1237,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 100% of available nodes.
|
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with 100% of available nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "REP 4 IN AllOne REP 4 IN AllTwo CBF 4 SELECT 2 FROM GEZero AS AllOne SELECT 2 FROM AllCountries AS AllTwo FILTER Country EQ Russia OR Country EQ Sweden OR Country EQ Finland AS AllCountries FILTER Price GE 0 AS GEZero"
|
placement_rule = "REP 4 IN AllOne REP 4 IN AllTwo CBF 4 SELECT 2 FROM GEZero AS AllOne SELECT 2 FROM AllCountries AS AllTwo FILTER Country EQ Russia OR Country EQ Sweden OR Country EQ Finland AS AllCountries FILTER Price GE 0 AS GEZero"
|
||||||
expected_params = {"country": ["Russia", "Sweden", "Finland"], "price": "0"}
|
placement_params = {"country": ["Russia", "Sweden", "Finland"], "price": 0}
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 4
|
expected_copies = 4
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -1261,11 +1262,12 @@ class TestPolicy(ClusterTestBase):
|
||||||
with allure.step(f"Check the object appearance"):
|
with allure.step(f"Check the object appearance"):
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check all node are selected"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert (netmap[node_address]["country"] in expected_params["country"]) or (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
netmap[node_address]["price"] in expected_params["price"]
|
assert (netmap[node_address]["country"] in placement_params["country"]) or (
|
||||||
), f"The node is selected from the wrong country or price. Expected {expected_params} and got {netmap[node_address]}"
|
int(netmap[node_address]["price"]) >= placement_params["price"]
|
||||||
|
), f"The node is selected from the wrong country or with wrong price. 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)
|
||||||
|
@ -1304,12 +1306,8 @@ class TestPolicy(ClusterTestBase):
|
||||||
assert (
|
assert (
|
||||||
len(resulting_copies) == expected_copies
|
len(resulting_copies) == expected_copies
|
||||||
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
|
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
|
|
||||||
with allure.step(f"Check the object appearance"):
|
with reporter.step(f"Delete the object from the container"):
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
with allure.step(f"Delete the container"):
|
with allure.step(f"Delete the container"):
|
||||||
|
@ -1346,9 +1344,6 @@ class TestPolicy(ClusterTestBase):
|
||||||
len(resulting_copies) == expected_copies
|
len(resulting_copies) == expected_copies
|
||||||
), 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"):
|
|
||||||
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"):
|
||||||
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)
|
||||||
|
|
||||||
|
@ -1366,8 +1361,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with UNIQUE nodes.
|
This test checks object's copies based on container's placement policy with SELECT and Complex FILTER results with UNIQUE nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "UNIQUE REP 1 IN RUS REP 1 IN RUS CBF 1 SELECT 1 FROM RU AS RUS FILTER Country NE Sweden AS NotSE FILTER @NotSE AND NOT (CountryCode EQ FI) AND Country EQ 'Russia' AS RU"
|
placement_rule = "UNIQUE REP 1 IN RUS REP 1 IN RUS CBF 1 SELECT 1 FROM RU AS RUS FILTER Country NE Sweden AS NotSE FILTER @NotSE AND NOT (CountryCode EQ FI) AND Country EQ 'Russia' AS RU"
|
||||||
expected_params = {"country": "Russia"}
|
placement_params = {"country_code": "FI", "country": ["Sweden", "Russia"]}
|
||||||
unexpected_params = {"country_code": "FI", "country": "Sweden"}
|
|
||||||
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
|
||||||
|
@ -1390,16 +1384,16 @@ 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"):
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(f"Check two nodes are selected not from {placement_params['country'][0]}"):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
for node in resulting_copies:
|
||||||
assert not (unexpected_params["country"] == netmap[node_address]["country"]) or (
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
not (unexpected_params["country"] == netmap[node_address]["country"])
|
assert not (placement_params["country"][0] == netmap[node_address]["country"]) or (
|
||||||
and not (expected_params["country_code"] == netmap[node_address]["country_code"])
|
not (placement_params["country"][0] == netmap[node_address]["country"])
|
||||||
or (expected_params["country"] == netmap[node_address]["country"])
|
and not (placement_params["country_code"] == netmap[node_address]["country_code"])
|
||||||
), f"The node is selected from the wrong country or country code. Expected {expected_params} and got {netmap[node_address]}"
|
and placement_params["country"][1] == netmap[node_address]["country"]
|
||||||
|
), f"The node is selected from the wrong country or with wrong country code. 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)
|
||||||
|
@ -1418,8 +1412,7 @@ class TestPolicy(ClusterTestBase):
|
||||||
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with UNIQUE nodes.
|
This test checks object's copies based on container's placement policy with Multi SELECTs and FILTERs results with UNIQUE nodes.
|
||||||
"""
|
"""
|
||||||
placement_rule = "UNIQUE REP 1 IN RU REP 1 IN EU REP 1 IN RU CBF 1 SELECT 1 FROM RUS AS RU SELECT 1 FROM EUR AS EU FILTER Country EQ Russia AS RUS FILTER NOT (@RUS) AND Country EQ Sweden OR CountryCode EQ FI AS EUR"
|
placement_rule = "UNIQUE REP 1 IN RU REP 1 IN EU REP 1 IN RU CBF 1 SELECT 1 FROM RUS AS RU SELECT 1 FROM EUR AS EU FILTER Country EQ Russia AS RUS FILTER NOT (@RUS) AND Country EQ Sweden OR CountryCode EQ FI AS EUR"
|
||||||
expected_params = {"country": ["Russia", "Sweden"], "country_code": "FI"}
|
placement_params = {"country": ["Russia", "Sweden"], "country_code": "FI"}
|
||||||
unexpected_params = {"country": "Russia"}
|
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 3
|
expected_copies = 3
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -1442,16 +1435,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"):
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
|
||||||
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
|
||||||
netmap = self.get_netmap_param(netmap)
|
netmap = self.get_netmap_param(netmap)
|
||||||
for node in resulting_copies:
|
with allure.step(
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
f"Check three nodes are selected from any country"
|
||||||
assert (expected_params["country"][0] == netmap[node_address]["country"]) or (
|
):
|
||||||
not (unexpected_params["country"][0] == netmap[node_address]["country"])
|
for node in resulting_copies:
|
||||||
and (expected_params["country"][1] == netmap[node_address]["country"])
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
or (expected_params["country_code"] == netmap[node_address]["country_code"])
|
assert (placement_params["country"][0] == netmap[node_address]["country"]) or (
|
||||||
), f"The node is selected from the wrong country or country code. Expected {expected_params} and got {netmap[node_address]}"
|
not (placement_params["country"][0] == netmap[node_address]["country"])
|
||||||
|
and (placement_params["country"][1] == netmap[node_address]["country"])
|
||||||
|
or (placement_params["country_code"] == netmap[node_address]["country_code"])
|
||||||
|
), f"The node is selected from the wrong country or with wrong country code. 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)
|
||||||
|
@ -1469,7 +1464,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.
|
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"
|
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"]}
|
placement_params = {"location": ["Saint Petersburg (ex Leningrad)", "Moskva"]}
|
||||||
file_path = generate_file(simple_object_size.value)
|
file_path = generate_file(simple_object_size.value)
|
||||||
expected_copies = 3
|
expected_copies = 3
|
||||||
endpoint = self.cluster.default_rpc_endpoint
|
endpoint = self.cluster.default_rpc_endpoint
|
||||||
|
@ -1499,15 +1494,14 @@ class TestPolicy(ClusterTestBase):
|
||||||
node_address = node.get_rpc_endpoint().split(":")[0]
|
node_address = node.get_rpc_endpoint().split(":")[0]
|
||||||
list_of_location.append(netmap[node_address]["location"])
|
list_of_location.append(netmap[node_address]["location"])
|
||||||
|
|
||||||
assert (
|
with allure.step(f"Check two or three nodes are selected from Russia and from any other country"):
|
||||||
expected_params["location"][0] in list_of_location
|
assert (
|
||||||
and expected_params["location"][1] in list_of_location
|
placement_params["location"][0] in list_of_location
|
||||||
and len(resulting_copies) > 2
|
and placement_params["location"][1] in list_of_location
|
||||||
), f"The node is selected from the wrong location. Expected {expected_params} and got {netmap[node_address]}"
|
and len(resulting_copies) > 2
|
||||||
|
), f"The node is selected from the wrong location. Got {netmap[node_address]}"
|
||||||
|
|
||||||
self.check_for_the_uniqueness_of_the_nodes(resulting_copies)
|
with reporter.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)
|
||||||
|
|
||||||
with allure.step(f"Delete the container"):
|
with allure.step(f"Delete the container"):
|
||||||
|
@ -1521,9 +1515,6 @@ class TestPolicy(ClusterTestBase):
|
||||||
"'", ""
|
"'", ""
|
||||||
), f"Expected \n{placement_rule} and got policy \n{got_policy} are the same"
|
), f"Expected \n{placement_rule} and got policy \n{got_policy} are the same"
|
||||||
|
|
||||||
def check_for_the_uniqueness_of_the_nodes(self, nodes: list):
|
|
||||||
assert len(set(nodes)) == len(nodes), f"The nodes found must be unique, but {nodes}"
|
|
||||||
|
|
||||||
def get_netmap_param(self, netmap_info: list[NodeNetmapInfo]) -> dict:
|
def get_netmap_param(self, netmap_info: list[NodeNetmapInfo]) -> dict:
|
||||||
dict_external = dict()
|
dict_external = dict()
|
||||||
for node in netmap_info:
|
for node in netmap_info:
|
||||||
|
|
Loading…
Reference in a new issue