diff --git a/pytest_tests/testsuites/object/test_object_api.py b/pytest_tests/testsuites/object/test_object_api.py index eb36df1e..31ec0f5e 100755 --- a/pytest_tests/testsuites/object/test_object_api.py +++ b/pytest_tests/testsuites/object/test_object_api.py @@ -10,6 +10,7 @@ from frostfs_testlib.resources.error_patterns import ( INVALID_OFFSET_SPECIFIER, INVALID_RANGE_OVERFLOW, INVALID_RANGE_ZERO_LENGTH, + OBJECT_ALREADY_REMOVED, OUT_OF_RANGE, ) from frostfs_testlib.shell import Shell @@ -23,7 +24,7 @@ from frostfs_testlib.steps.cli.object import ( search_object, ) from frostfs_testlib.steps.complex_object_actions import get_complex_object_split_ranges -from frostfs_testlib.steps.storage_object import delete_objects +from frostfs_testlib.steps.storage_object import delete_object, delete_objects from frostfs_testlib.steps.storage_policy import get_complex_object_copies, get_simple_object_copies from frostfs_testlib.storage.cluster import Cluster from frostfs_testlib.storage.dataclasses.object_size import ObjectSize @@ -94,11 +95,17 @@ def generate_ranges( scope="module" ) def storage_objects( - default_wallet: WalletInfo, client_shell: Shell, cluster: Cluster, object_size: ObjectSize, placement_policy: PlacementPolicy + default_wallet: WalletInfo, + client_shell: Shell, + cluster: Cluster, + object_size: ObjectSize, + placement_policy: PlacementPolicy, ) -> list[StorageObjectInfo]: wallet = default_wallet # Separate containers for complex/simple objects to avoid side-effects - cid = create_container(wallet, shell=client_shell, rule=placement_policy.value, endpoint=cluster.default_rpc_endpoint) + cid = create_container( + wallet, shell=client_shell, rule=placement_policy.value, endpoint=cluster.default_rpc_endpoint + ) file_path = generate_file(object_size.value) file_hash = get_file_hash(file_path) @@ -209,6 +216,24 @@ class TestObjectApi(ClusterTestBase): ) self.check_header_is_presented(head_info, storage_object_2.attributes) + @allure.title("Head deleted object with --raw arg (obj_size={object_size}, policy={placement_policy})") + def test_object_head_raw(self, default_wallet: str, object_size: ObjectSize, placement_policy: PlacementPolicy): + with reporter.step("Create container"): + cid = create_container( + default_wallet, self.shell, self.cluster.default_rpc_endpoint, placement_policy.value + ) + + with reporter.step("Upload object"): + file_path = generate_file(object_size.value) + oid = put_object_to_random_node(default_wallet, file_path, cid, self.shell, self.cluster) + + with reporter.step("Delete object"): + delete_object(default_wallet, cid, oid, self.shell, self.cluster.default_rpc_endpoint) + + with reporter.step("Call object head --raw and expect error"): + with pytest.raises(Exception, match=OBJECT_ALREADY_REMOVED): + head_object(default_wallet, cid, oid, self.shell, self.cluster.default_rpc_endpoint, is_raw=True) + @allure.title("Search objects by native API (obj_size={object_size}, policy={placement_policy})") def test_search_object_api(self, storage_objects: list[StorageObjectInfo]): """