Add test down all data interfaces

Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
Dmitriy Zayakin 2023-10-19 10:38:42 +03:00 committed by Dmitriy Zayakin
parent bcc61303df
commit 2564f7421e

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.controllers.cluster_state_controller import ClusterStateController
from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.object_size import ObjectSize
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase 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 from frostfs_testlib.utils.file_utils import generate_file
logger = logging.getLogger("NeoLogger") logger = logging.getLogger("NeoLogger")
@ -63,32 +64,38 @@ class TestReplication(ClusterTestBase):
attributes=OBJECT_ATTRIBUTES, attributes=OBJECT_ATTRIBUTES,
copies_number=3, copies_number=3,
endpoint=random.choice(alive_nodes).storage_node.get_rpc_endpoint(), endpoint=random.choice(alive_nodes).storage_node.get_rpc_endpoint(),
timeout="45s",
) )
cluster_state_controller.start_node_host(node_for_rep) cluster_state_controller.start_node_host(node_for_rep)
with allure.step(f"Wait for replication. Sleep {WAIT_FOR_REPLICATION}s"): with allure.step(f"Wait for replication."):
sleep(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("Check attributes"):
with allure.step(f"Check object on node {node}"): for node in object_nodes:
header_info = head_object( header_info = head_object(
wallet=default_wallet, wallet=default_wallet,
oid=oid, oid=oid,
cid=cid, cid=cid,
shell=self.shell, shell=self.shell,
endpoint=node.storage_node.get_rpc_endpoint(), endpoint=node.get_rpc_endpoint(),
is_direct=True, is_direct=True,
)["header"] )["header"]
attributes = header_info["attributes"] attributes = header_info["attributes"]
for attribute_key, attribute_value in OBJECT_ATTRIBUTES.items(): for attribute_key, attribute_value in OBJECT_ATTRIBUTES.items():
assert ( assert attribute_key in attributes, f"{attribute_key} not found in {header_info}"
attribute_key in attributes
), f"{attribute_key} not found in {header_info}"
assert header_info["attributes"].get(attribute_key) == str(attribute_value), ( assert header_info["attributes"].get(attribute_key) == str(attribute_value), (
f"{attribute_key} value not equal: " f"{attribute_key} value not equal: "
f"got attribute value: {attributes.get(attribute_key)}" f"got attribute value: {attributes.get(attribute_key)}"
f"expected attribute value: {attribute_value}" f"expected attribute value: {attribute_value}"
) )
with allure.step("Cleanup"): with allure.step("Cleanup"):
delete_object( delete_object(
wallet=default_wallet, wallet=default_wallet,