From 236be159dbe4e6612621f05ca616dc92cb79fa12 Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Tue, 4 Jun 2024 18:24:21 +0300 Subject: [PATCH] [#244] Fix test policies --- pytest_tests/testsuites/object/conftest.py | 9 +++++++++ pytest_tests/testsuites/object/test_object_api.py | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 pytest_tests/testsuites/object/conftest.py diff --git a/pytest_tests/testsuites/object/conftest.py b/pytest_tests/testsuites/object/conftest.py new file mode 100644 index 00000000..9898f505 --- /dev/null +++ b/pytest_tests/testsuites/object/conftest.py @@ -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 diff --git a/pytest_tests/testsuites/object/test_object_api.py b/pytest_tests/testsuites/object/test_object_api.py index 31ec0f5e..dfbeceb8 100755 --- a/pytest_tests/testsuites/object/test_object_api.py +++ b/pytest_tests/testsuites/object/test_object_api.py @@ -147,6 +147,7 @@ class TestObjectApi(ClusterTestBase): self, storage_objects: list[StorageObjectInfo], simple_object_size: ObjectSize, + expected_object_copies: int, ): """ Validate object storage policy @@ -170,7 +171,7 @@ class TestObjectApi(ClusterTestBase): shell=self.shell, 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})") def test_get_object_api(self, storage_objects: list[StorageObjectInfo]):