Changes for object size usage
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
05b5f7d133
commit
6449264dcf
29 changed files with 425 additions and 302 deletions
|
@ -25,6 +25,7 @@ from frostfs_testlib.steps.complex_object_actions import get_complex_object_spli
|
|||
from frostfs_testlib.steps.storage_object import 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
|
||||
from frostfs_testlib.storage.dataclasses.storage_object_info import StorageObjectInfo
|
||||
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase
|
||||
from frostfs_testlib.utils.file_utils import generate_file, get_file_content, get_file_hash
|
||||
|
@ -90,7 +91,7 @@ def generate_ranges(
|
|||
|
||||
@pytest.fixture(
|
||||
params=[pytest.lazy_fixture("simple_object_size"), pytest.lazy_fixture("complex_object_size")],
|
||||
ids=["simple object", "complex object"],
|
||||
ids=["simple object size", "complex object size"],
|
||||
# Scope session to upload/delete each files set only once
|
||||
scope="module",
|
||||
)
|
||||
|
@ -100,8 +101,9 @@ def storage_objects(
|
|||
wallet = default_wallet
|
||||
# Separate containers for complex/simple objects to avoid side-effects
|
||||
cid = create_container(wallet, shell=client_shell, endpoint=cluster.default_rpc_endpoint)
|
||||
object_size: ObjectSize = request.param
|
||||
|
||||
file_path = generate_file(request.param)
|
||||
file_path = generate_file(object_size.value)
|
||||
file_hash = get_file_hash(file_path)
|
||||
|
||||
storage_objects = []
|
||||
|
@ -119,7 +121,7 @@ def storage_objects(
|
|||
)
|
||||
|
||||
storage_object = StorageObjectInfo(cid, storage_object_id)
|
||||
storage_object.size = request.param
|
||||
storage_object.size = object_size.value
|
||||
storage_object.wallet_file_path = wallet
|
||||
storage_object.file_path = file_path
|
||||
storage_object.file_hash = file_hash
|
||||
|
@ -138,7 +140,10 @@ def storage_objects(
|
|||
class TestObjectApi(ClusterTestBase):
|
||||
@allure.title("Validate object storage policy by native API")
|
||||
def test_object_storage_policies(
|
||||
self, request: FixtureRequest, storage_objects: list[StorageObjectInfo], simple_object_size
|
||||
self,
|
||||
request: FixtureRequest,
|
||||
storage_objects: list[StorageObjectInfo],
|
||||
simple_object_size: ObjectSize,
|
||||
):
|
||||
"""
|
||||
Validate object storage policy
|
||||
|
@ -149,7 +154,7 @@ class TestObjectApi(ClusterTestBase):
|
|||
|
||||
with allure.step("Validate storage policy for objects"):
|
||||
for storage_object in storage_objects:
|
||||
if storage_object.size == simple_object_size:
|
||||
if storage_object.size == simple_object_size.value:
|
||||
copies = get_simple_object_copies(
|
||||
storage_object.wallet_file_path,
|
||||
storage_object.cid,
|
||||
|
@ -265,10 +270,10 @@ class TestObjectApi(ClusterTestBase):
|
|||
@pytest.mark.parametrize(
|
||||
"object_size",
|
||||
[pytest.lazy_fixture("simple_object_size"), pytest.lazy_fixture("complex_object_size")],
|
||||
ids=["simple object", "complex object"],
|
||||
ids=["simple object size", "complex object size"],
|
||||
)
|
||||
def test_object_search_should_return_tombstone_items(
|
||||
self, default_wallet: str, request: FixtureRequest, object_size: int
|
||||
self, default_wallet: str, request: FixtureRequest, object_size: ObjectSize
|
||||
):
|
||||
"""
|
||||
Validate object search with removed items
|
||||
|
@ -281,13 +286,13 @@ class TestObjectApi(ClusterTestBase):
|
|||
cid = create_container(wallet, self.shell, self.cluster.default_rpc_endpoint)
|
||||
|
||||
with allure.step("Upload file"):
|
||||
file_path = generate_file(object_size)
|
||||
file_path = generate_file(object_size.value)
|
||||
file_hash = get_file_hash(file_path)
|
||||
|
||||
storage_object = StorageObjectInfo(
|
||||
cid=cid,
|
||||
oid=put_object_to_random_node(wallet, file_path, cid, self.shell, self.cluster),
|
||||
size=object_size,
|
||||
size=object_size.value,
|
||||
wallet_file_path=wallet,
|
||||
file_path=file_path,
|
||||
file_hash=file_hash,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue