[#303] add morph and local object ape tests
Some checks failed
DCO check / Commits Check (pull_request) Failing after 19s
Some checks failed
DCO check / Commits Check (pull_request) Failing after 19s
This commit is contained in:
parent
d10e5975e7
commit
035610914e
3 changed files with 1705 additions and 5 deletions
|
@ -10,9 +10,10 @@ from pytest_tests.helpers.object_access import (
|
||||||
can_delete_object,
|
can_delete_object,
|
||||||
can_get_head_object,
|
can_get_head_object,
|
||||||
can_get_object,
|
can_get_object,
|
||||||
|
can_get_object_from_random_node,
|
||||||
can_get_range_hash_of_object,
|
can_get_range_hash_of_object,
|
||||||
can_get_range_of_object,
|
can_get_range_of_object,
|
||||||
can_put_object,
|
can_put_object_to_random_node,
|
||||||
can_search_object,
|
can_search_object,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,12 +38,12 @@ def assert_access_to_container(
|
||||||
endpoint = cluster.default_rpc_endpoint
|
endpoint = cluster.default_rpc_endpoint
|
||||||
results: dict = {}
|
results: dict = {}
|
||||||
|
|
||||||
results[ape.ObjectOperations.PUT] = can_put_object(wallet, cid, file_name, shell, cluster, bearer, xhdr)
|
results[ape.ObjectOperations.PUT] = can_put_object_to_random_node(wallet, cid, file_name, shell, cluster, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.HEAD] = can_get_head_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
results[ape.ObjectOperations.HEAD] = can_get_head_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.GET_RANGE] = can_get_range_of_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
results[ape.ObjectOperations.GET_RANGE] = can_get_range_of_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.GET_RANGE_HASH] = can_get_range_hash_of_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
results[ape.ObjectOperations.GET_RANGE_HASH] = can_get_range_hash_of_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.SEARCH] = can_search_object(wallet, cid, shell, endpoint, oid, bearer, xhdr)
|
results[ape.ObjectOperations.SEARCH] = can_search_object(wallet, cid, shell, endpoint, oid, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.GET] = can_get_object(wallet, cid, oid, file_name, shell, cluster, bearer, xhdr)
|
results[ape.ObjectOperations.GET] = can_get_object_from_random_node(wallet, cid, oid, file_name, shell, cluster, bearer, xhdr)
|
||||||
results[ape.ObjectOperations.DELETE] = can_delete_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
results[ape.ObjectOperations.DELETE] = can_delete_object(wallet, cid, oid, shell, endpoint, bearer, xhdr)
|
||||||
|
|
||||||
failed_checks = [
|
failed_checks = [
|
||||||
|
|
|
@ -6,10 +6,12 @@ from frostfs_testlib.resources.error_patterns import OBJECT_ACCESS_DENIED
|
||||||
from frostfs_testlib.shell import Shell
|
from frostfs_testlib.shell import Shell
|
||||||
from frostfs_testlib.steps.cli.object import (
|
from frostfs_testlib.steps.cli.object import (
|
||||||
delete_object,
|
delete_object,
|
||||||
|
get_object,
|
||||||
get_object_from_random_node,
|
get_object_from_random_node,
|
||||||
get_range,
|
get_range,
|
||||||
get_range_hash,
|
get_range_hash,
|
||||||
head_object,
|
head_object,
|
||||||
|
put_object,
|
||||||
put_object_to_random_node,
|
put_object_to_random_node,
|
||||||
search_object,
|
search_object,
|
||||||
)
|
)
|
||||||
|
@ -21,7 +23,7 @@ from frostfs_testlib.utils.file_utils import get_file_hash
|
||||||
OPERATION_ERROR_TYPE = RuntimeError
|
OPERATION_ERROR_TYPE = RuntimeError
|
||||||
|
|
||||||
|
|
||||||
def can_get_object(
|
def can_get_object_from_random_node(
|
||||||
wallet: WalletInfo,
|
wallet: WalletInfo,
|
||||||
cid: str,
|
cid: str,
|
||||||
oid: str,
|
oid: str,
|
||||||
|
@ -49,7 +51,35 @@ def can_get_object(
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def can_put_object(
|
def can_get_object(
|
||||||
|
wallet: WalletInfo,
|
||||||
|
cid: str,
|
||||||
|
oid: str,
|
||||||
|
file_name: str,
|
||||||
|
shell: Shell,
|
||||||
|
endpoint: str,
|
||||||
|
bearer: Optional[str] = None,
|
||||||
|
xhdr: Optional[dict] = None,
|
||||||
|
) -> bool:
|
||||||
|
with reporter.step("Try get object from container"):
|
||||||
|
try:
|
||||||
|
got_file_path = get_object(
|
||||||
|
wallet,
|
||||||
|
cid,
|
||||||
|
oid,
|
||||||
|
shell=shell,
|
||||||
|
endpoint=endpoint,
|
||||||
|
bearer=bearer,
|
||||||
|
xhdr=xhdr,
|
||||||
|
)
|
||||||
|
except OPERATION_ERROR_TYPE as err:
|
||||||
|
assert string_utils.is_str_match_pattern(err, OBJECT_ACCESS_DENIED), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
|
return False
|
||||||
|
assert get_file_hash(file_name) == get_file_hash(got_file_path)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def can_put_object_to_random_node(
|
||||||
wallet: WalletInfo,
|
wallet: WalletInfo,
|
||||||
cid: str,
|
cid: str,
|
||||||
file_name: str,
|
file_name: str,
|
||||||
|
@ -77,6 +107,36 @@ def can_put_object(
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def can_put_object(
|
||||||
|
wallet: WalletInfo,
|
||||||
|
cid: str,
|
||||||
|
file_name: str,
|
||||||
|
shell: Shell,
|
||||||
|
endpoint: str,
|
||||||
|
bearer: Optional[str] = None,
|
||||||
|
xhdr: Optional[dict] = None,
|
||||||
|
attributes: Optional[dict] = None,
|
||||||
|
copies_number: int | None = None,
|
||||||
|
) -> bool:
|
||||||
|
with reporter.step("Try put object to container"):
|
||||||
|
try:
|
||||||
|
put_object(
|
||||||
|
wallet=wallet,
|
||||||
|
cid=cid,
|
||||||
|
path=file_name,
|
||||||
|
endpoint=endpoint,
|
||||||
|
bearer=bearer,
|
||||||
|
xhdr=xhdr,
|
||||||
|
attributes=attributes,
|
||||||
|
shell=shell,
|
||||||
|
copies_number=copies_number,
|
||||||
|
)
|
||||||
|
except OPERATION_ERROR_TYPE as err:
|
||||||
|
assert string_utils.is_str_match_pattern(err, OBJECT_ACCESS_DENIED), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def can_delete_object(
|
def can_delete_object(
|
||||||
wallet: WalletInfo,
|
wallet: WalletInfo,
|
||||||
cid: str,
|
cid: str,
|
||||||
|
|
1639
pytest_tests/testsuites/ape/test_ape.py
Normal file
1639
pytest_tests/testsuites/ape/test_ape.py
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue