Fix policy for replication test #111

Merged
d.zayakin merged 1 commit from d.zayakin/frostfs-testcases:fix-replication-test into master 2023-10-19 10:04:23 +00:00

View file

@ -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), (
abereziny marked this conversation as resolved Outdated

We lost attributes check?

We lost attributes check?

return check

return check
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,