[#200] Validate object get range hash with different nodes

Validate object get range hash with different nodes

Signed-off-by: Mikhail Kadilov m.kadilov@yadro.com
Mikhail Kadilov 2024-02-22 09:52:12 +03:00
parent 6ee9b70d50
commit 1ea1651c59
1 changed files with 81 additions and 1 deletions

View File

@ -13,7 +13,7 @@ from frostfs_testlib.resources.error_patterns import (
OUT_OF_RANGE,
)
from frostfs_testlib.shell import Shell
from frostfs_testlib.steps.cli.container import create_container
from frostfs_testlib.steps.cli.container import create_container, search_nodes_with_container
from frostfs_testlib.steps.cli.object import (
get_object_from_random_node,
get_range,
@ -133,6 +133,9 @@ def storage_objects(
@pytest.mark.sanity
@pytest.mark.grpc_api
class TestObjectApi(ClusterTestBase):
PLACEMENT_RULE_1 = "REP 1 IN X CBF 1 SELECT 1 FROM * AS X"
@allure.title("Storage policy by native API (obj_size={object_size})")
def test_object_storage_policies(
self,
@ -459,6 +462,83 @@ class TestObjectApi(ClusterTestBase):
range_cut=range_cut,
)
@allure.title("Trying to execute object get range hash command on node from container and node not from container")
def test_object_get_range_hash_with_different_nodes(self, default_wallet: str, object_size: ObjectSize):
"""
Validate get range hash command with different nodes
"""
wallet = default_wallet
cid = create_container(wallet, self.shell, self.cluster.default_rpc_endpoint, self.PLACEMENT_RULE_1)
file_path = generate_file(object_size.value)
oid = put_object_to_random_node(wallet, file_path, cid, self.shell, self.cluster)
# taking node from container
nodes = search_nodes_with_container(
wallet=wallet,
cid=cid,
shell=self.shell,
endpoint=self.cluster.default_rpc_endpoint,
cluster=self.cluster,
)
container_node = nodes[0]
# range_cut????????
with reporter.step("Execute command on container node"):
result = get_range_hash(wallet, cid, oid, range_cut, container_node.host, self.cluster.default_rpc_endpoint)
assert "object not found" not in result
# taking node NOT from container
for cluster_node in self.cluster.cluster_nodes:
if cluster_node.id != container_node.id:
not_container_node = cluster_node
break
# range_cut????????????????
with reporter.step("Execute command on not container node"):
result = get_range_hash(wallet, cid, oid, range_cut, not_container_node.host, self.cluster.default_rpc_endpoint)
assert "object not found" not in result
@allure.title("Trying to execute object get range hash command on node from container and node not from container")
def test_object_get_range_with_different_nodes(self, default_wallet: str, object_size: ObjectSize):
"""
Validate get range command with different nodes
"""
wallet = default_wallet
cid = create_container(wallet, self.shell, self.cluster.default_rpc_endpoint, self.PLACEMENT_RULE_1)
file_path = generate_file(object_size.value)
oid = put_object_to_random_node(wallet, file_path, cid, self.shell, self.cluster)
# taking node from container
nodes = search_nodes_with_container(
wallet=wallet,
cid=cid,
shell=self.shell,
endpoint=self.cluster.default_rpc_endpoint,
cluster=self.cluster,
)
container_node = nodes[0]
# range_cut????????
with reporter.step("Execute command on container node"):
result = get_range(wallet, cid, oid, range_cut, container_node.host, self.cluster.default_rpc_endpoint)
assert "object not found" not in result
# taking node NOT from container
for cluster_node in self.cluster.cluster_nodes:
if cluster_node.id != container_node.id:
not_container_node = cluster_node
break
# range_cut????????????????
with reporter.step("Execute command on not container node"):
result = get_range(wallet, cid, oid, range_cut, not_container_node.host, self.cluster.default_rpc_endpoint)
assert "object not found" not in result
def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
for key_to_check, val_to_check in object_header.items():
assert key_to_check in head_info["header"]["attributes"], f"Key {key_to_check} is found in {head_object}"