[#244] Fix test policies
Some checks reported warnings
DCO check / Commits Check (pull_request) Has been cancelled
Some checks reported warnings
DCO check / Commits Check (pull_request) Has been cancelled
This commit is contained in:
parent
9cf083fac9
commit
04274fdfb4
2 changed files with 19 additions and 3 deletions
9
pytest_tests/testsuites/object/conftest.py
Normal file
9
pytest_tests/testsuites/object/conftest.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import pytest
|
||||||
|
from frostfs_testlib.storage.dataclasses.policy import PlacementPolicy
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def expected_object_copies(placement_policy: PlacementPolicy) -> int:
|
||||||
|
if placement_policy.name == "rep":
|
||||||
|
return 2
|
||||||
|
return 4
|
|
@ -94,11 +94,17 @@ def generate_ranges(
|
||||||
scope="module"
|
scope="module"
|
||||||
)
|
)
|
||||||
def storage_objects(
|
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]:
|
) -> list[StorageObjectInfo]:
|
||||||
wallet = default_wallet
|
wallet = default_wallet
|
||||||
# Separate containers for complex/simple objects to avoid side-effects
|
# 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_path = generate_file(object_size.value)
|
||||||
file_hash = get_file_hash(file_path)
|
file_hash = get_file_hash(file_path)
|
||||||
|
@ -140,6 +146,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
self,
|
self,
|
||||||
storage_objects: list[StorageObjectInfo],
|
storage_objects: list[StorageObjectInfo],
|
||||||
simple_object_size: ObjectSize,
|
simple_object_size: ObjectSize,
|
||||||
|
expected_object_copies: int,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Validate object storage policy
|
Validate object storage policy
|
||||||
|
@ -163,7 +170,7 @@ class TestObjectApi(ClusterTestBase):
|
||||||
shell=self.shell,
|
shell=self.shell,
|
||||||
nodes=self.cluster.storage_nodes,
|
nodes=self.cluster.storage_nodes,
|
||||||
)
|
)
|
||||||
assert copies == 2, "Expected 2 copies"
|
assert copies == expected_object_copies, f"Expected {expected_object_copies} copies"
|
||||||
|
|
||||||
@allure.title("Get object by native API (obj_size={object_size}, policy={placement_policy})")
|
@allure.title("Get object by native API (obj_size={object_size}, policy={placement_policy})")
|
||||||
def test_get_object_api(self, storage_objects: list[StorageObjectInfo]):
|
def test_get_object_api(self, storage_objects: list[StorageObjectInfo]):
|
||||||
|
|
Loading…
Reference in a new issue