add reporter

pull/175/head
Ekaterina Chernitsyna 2023-12-08 15:07:34 +03:00 committed by Andrey Berezin
parent 9712644c38
commit 7b688af84d
1 changed files with 26 additions and 26 deletions

View File

@ -1,5 +1,5 @@
import allure
import pytest
import allure
from frostfs_testlib import reporter
from frostfs_testlib.resources.wellknown_acl import PUBLIC_ACL
from frostfs_testlib.steps.cli.container import create_container, delete_container, get_container
@ -205,7 +205,7 @@ class TestPolicy(ClusterTestBase):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
with allure.step(f"Check the node is selected from {placement_params['country']}"):
with reporter.step(f"Check the node is selected from {placement_params['country']}"):
assert (
placement_params["country"] == netmap[node_address]["country"]
), f"The node is selected from the wrong country. Got {netmap[node_address]}"
@ -252,7 +252,7 @@ class TestPolicy(ClusterTestBase):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
with allure.step(
with reporter.step(
f"Check the node is selected from {placement_params['country'][0]}"
):
assert (
@ -304,7 +304,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected from any country"):
with reporter.step(f"Check two nodes are selected from any country"):
for node in resulting_copies:
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
assert (placement_params["country"][1] == netmap[node_address]["country"]) or (
@ -335,7 +335,7 @@ class TestPolicy(ClusterTestBase):
expected_copies = 2
endpoint = self.cluster.default_rpc_endpoint
with allure.step(f"Create container with policy {placement_rule}"):
with reporter.step(f"Create container with policy {placement_rule}"):
cid = create_container(
wallet=default_wallet, rule=placement_rule, basic_acl=PUBLIC_ACL, shell=self.shell, endpoint=endpoint
)
@ -352,10 +352,10 @@ class TestPolicy(ClusterTestBase):
len(resulting_copies) == expected_copies
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected from {placement_params['country']}"):
with reporter.step(f"Check two nodes are selected from {placement_params['country']}"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -479,7 +479,7 @@ class TestPolicy(ClusterTestBase):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
with allure.step(f"Check the node is selected with price <= {placement_params['price']}"):
with reporter.step(f"Check the node is selected with price <= {placement_params['price']}"):
assert (
int(netmap[node_address]["price"]) <= placement_params["price"]
), f"The node is selected with the wrong price. Got {netmap[node_address]}"
@ -526,7 +526,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check the node is selected with price between 1 and 10"):
with reporter.step(f"Check the node is selected with price between 1 and 10"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -576,7 +576,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected with max and min prices"):
with reporter.step(f"Check two nodes are selected with max and min prices"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -700,7 +700,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected with price > {placement_params['price']}"):
with reporter.step(f"Check two nodes are selected with price > {placement_params['price']}"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -749,7 +749,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected not with country code '{placement_params['country_code']}'"):
with reporter.step(f"Check two nodes are selected not with country code '{placement_params['country_code']}'"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (not netmap[node_address]["country_code"] == placement_params["country_code"]
@ -799,7 +799,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check all nodes are selected"):
with reporter.step(f"Check all nodes are selected"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -932,7 +932,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected with price < {placement_params['price']}"):
with reporter.step(f"Check two nodes are selected with price < {placement_params['price']}"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -981,7 +981,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check three nodes are selected not from {placement_params['continent']}"
with reporter.step(f"Check three nodes are selected not from {placement_params['continent']}"
):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
@ -1034,7 +1034,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check all nodes are selected"):
with reporter.step(f"Check all nodes are selected"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -1163,11 +1163,11 @@ class TestPolicy(ClusterTestBase):
len(resulting_copies) == expected_copies
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
node_address = resulting_copies[0].get_rpc_endpoint().split(":")[0]
with allure.step(f"Check the node is selected with price >= {placement_params['price']}"):
with reporter.step(f"Check the node is selected with price >= {placement_params['price']}"):
assert (
netmap[node_address]["price"] >= int(placement_params["price"])
), f"The node is selected with the wrong price. Got {netmap[node_address]}"
@ -1213,7 +1213,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected from {' or '.join(placement_params['country'])}"):
with reporter.step(f"Check two nodes are selected from {' or '.join(placement_params['country'])}"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (
@ -1263,7 +1263,7 @@ class TestPolicy(ClusterTestBase):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check all node are selected"):
with reporter.step(f"Check all node are selected"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert (netmap[node_address]["country"] in placement_params["country"]) or (
@ -1345,7 +1345,7 @@ class TestPolicy(ClusterTestBase):
len(resulting_copies) == expected_copies
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Delete the object from the container"):
with reporter.step(f"Delete the object from the container"):
delete_object(wallet=default_wallet, cid=cid, oid=oid, shell=self.shell, endpoint=endpoint)
with reporter.step(f"Delete the container"):
@ -1384,10 +1384,10 @@ class TestPolicy(ClusterTestBase):
len(resulting_copies) == expected_copies
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(f"Check two nodes are selected not from {placement_params['country'][0]}"):
with reporter.step(f"Check two nodes are selected not from {placement_params['country'][0]}"):
for node in resulting_copies:
node_address = node.get_rpc_endpoint().split(":")[0]
assert not (placement_params["country"][0] == netmap[node_address]["country"]) or (
@ -1435,10 +1435,10 @@ class TestPolicy(ClusterTestBase):
len(resulting_copies) == expected_copies
), f"Expected {expected_copies} copies, got {len(resulting_copies)}"
with allure.step(f"Check the object appearance"):
with reporter.step(f"Check the object appearance"):
netmap = parse_netmap_output(get_netmap_snapshot(node=resulting_copies[0], shell=self.shell))
netmap = self.get_netmap_param(netmap)
with allure.step(
with reporter.step(
f"Check three nodes are selected from any country"
):
for node in resulting_copies:
@ -1495,7 +1495,7 @@ class TestPolicy(ClusterTestBase):
node_address = node.get_rpc_endpoint().split(":")[0]
list_of_location.append(netmap[node_address]["location"])
with allure.step(f"Check two or three nodes are selected from Russia and from any other country"):
with reporter.step(f"Check two or three nodes are selected from Russia and from any other country"):
assert (
placement_params["location"][0] in list_of_location
and placement_params["location"][1] in list_of_location