[#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
This commit is contained in:
parent
9068b96d69
commit
7a445fc67e
1 changed files with 81 additions and 1 deletions
|
@ -13,7 +13,7 @@ from frostfs_testlib.resources.error_patterns import (
|
||||||
OUT_OF_RANGE,
|
OUT_OF_RANGE,
|
||||||
)
|
)
|
||||||
from frostfs_testlib.shell import Shell
|
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 (
|
from frostfs_testlib.steps.cli.object import (
|
||||||
get_object_from_random_node,
|
get_object_from_random_node,
|
||||||
get_range,
|
get_range,
|
||||||
|
@ -133,6 +133,9 @@ def storage_objects(
|
||||||
@pytest.mark.sanity
|
@pytest.mark.sanity
|
||||||
@pytest.mark.grpc_api
|
@pytest.mark.grpc_api
|
||||||
class TestObjectApi(ClusterTestBase):
|
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})")
|
@allure.title("Storage policy by native API (obj_size={object_size})")
|
||||||
def test_object_storage_policies(
|
def test_object_storage_policies(
|
||||||
self,
|
self,
|
||||||
|
@ -459,6 +462,83 @@ class TestObjectApi(ClusterTestBase):
|
||||||
range_cut=range_cut,
|
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, client_shell: Shell):
|
||||||
|
"""
|
||||||
|
Validate get range hash command with node from container and node not from container
|
||||||
|
"""
|
||||||
|
shell = client_shell
|
||||||
|
wallet = default_wallet
|
||||||
|
cid = create_container(wallet, 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, shell, self.cluster)
|
||||||
|
|
||||||
|
# taking node from container
|
||||||
|
nodes = search_nodes_with_container(
|
||||||
|
wallet=wallet,
|
||||||
|
cid=cid,
|
||||||
|
shell=shell,
|
||||||
|
endpoint=self.cluster.default_rpc_endpoint,
|
||||||
|
cluster=self.cluster,
|
||||||
|
)
|
||||||
|
container_node = nodes[0]
|
||||||
|
range_cut="0:10"
|
||||||
|
with reporter.step("Execute command on container node"):
|
||||||
|
result = get_range_hash(wallet, cid, oid, range_cut, shell, container_node.storage_node.get_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="0:10"
|
||||||
|
with reporter.step("Execute command on not container node"):
|
||||||
|
result = get_range_hash(wallet, cid, oid, range_cut, shell, not_container_node.storage_node.get_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, client_shell: Shell):
|
||||||
|
"""
|
||||||
|
Validate get range command with node from container and node not from container
|
||||||
|
"""
|
||||||
|
|
||||||
|
shell = client_shell
|
||||||
|
wallet = default_wallet
|
||||||
|
cid = create_container(wallet, 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, shell, self.cluster)
|
||||||
|
|
||||||
|
# taking node from container
|
||||||
|
nodes = search_nodes_with_container(
|
||||||
|
wallet=wallet,
|
||||||
|
cid=cid,
|
||||||
|
shell=shell,
|
||||||
|
endpoint=self.cluster.default_rpc_endpoint,
|
||||||
|
cluster=self.cluster,
|
||||||
|
)
|
||||||
|
container_node = nodes[0]
|
||||||
|
range_cut="0:10"
|
||||||
|
with reporter.step("Execute command on container node"):
|
||||||
|
result = get_range(wallet, cid, oid, range_cut, shell, container_node.storage_node.get_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="0:10"
|
||||||
|
with reporter.step("Execute command on not container node"):
|
||||||
|
result = get_range(wallet, cid, oid, range_cut, shell, not_container_node.storage_node.get_rpc_endpoint())
|
||||||
|
assert "object not found" not in result
|
||||||
|
|
||||||
def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
|
def check_header_is_presented(self, head_info: dict, object_header: dict) -> None:
|
||||||
for key_to_check, val_to_check in object_header.items():
|
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}"
|
assert key_to_check in head_info["header"]["attributes"], f"Key {key_to_check} is found in {head_object}"
|
||||||
|
|
Loading…
Reference in a new issue