From 17d5af9ccb128ffb60751898b3f080d01cd595bd Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Thu, 1 Aug 2024 16:31:22 +0300 Subject: [PATCH] [#280] Update verify object func Signed-off-by: Dmitriy Zayakin --- .../failovers/test_failover_server.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pytest_tests/testsuites/failovers/test_failover_server.py b/pytest_tests/testsuites/failovers/test_failover_server.py index 6b03fca3..bb5f9973 100644 --- a/pytest_tests/testsuites/failovers/test_failover_server.py +++ b/pytest_tests/testsuites/failovers/test_failover_server.py @@ -1,5 +1,6 @@ import itertools import logging +import os import random import allure @@ -15,7 +16,7 @@ from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.storage_object_info import StorageObjectInfo from frostfs_testlib.storage.dataclasses.wallet import WalletInfo from frostfs_testlib.testing.cluster_test_base import ClusterTestBase -from frostfs_testlib.testing.parallel import parallel +from frostfs_testlib.testing.parallel import parallel, parallel_workers_limit from frostfs_testlib.testing.test_control import wait_for_success from frostfs_testlib.utils.file_utils import get_file_hash from pytest import FixtureRequest @@ -55,8 +56,7 @@ class TestFailoverServer(ClusterTestBase): ) containers = [ - StorageContainer(StorageContainerInfo(result.result(), default_wallet), self.shell, self.cluster) - for result in results + StorageContainer(StorageContainerInfo(result.result(), default_wallet), self.shell, self.cluster) for result in results ] return containers @@ -102,9 +102,7 @@ class TestFailoverServer(ClusterTestBase): @allure.title("[Test] Create objects and get nodes with object") @pytest.fixture() - def object_and_nodes( - self, simple_object_size: ObjectSize, container: StorageContainer - ) -> tuple[StorageObjectInfo, list[ClusterNode]]: + def object_and_nodes(self, simple_object_size: ObjectSize, container: StorageContainer) -> tuple[StorageObjectInfo, list[ClusterNode]]: object_info = container.generate_object(simple_object_size.value) object_nodes = get_object_nodes(self.cluster, object_info.cid, object_info.oid, self.cluster.cluster_nodes[0]) return object_info, object_nodes @@ -124,7 +122,9 @@ class TestFailoverServer(ClusterTestBase): @reporter.step("Verify objects") def verify_objects(self, nodes: list[StorageNode], storage_objects: list[StorageObjectInfo]) -> None: - parallel(self._verify_object, storage_objects * len(nodes), node=itertools.cycle(nodes)) + workers_count = os.environ.get("PARALLEL_CUSTOM_LIMIT", 50) + with parallel_workers_limit(workers_count): + parallel(self._verify_object, storage_objects * len(nodes), node=itertools.cycle(nodes)) @allure.title("Full shutdown node") @pytest.mark.parametrize("containers, storage_objects", [(5, 10)], indirect=True) @@ -200,9 +200,7 @@ class TestFailoverServer(ClusterTestBase): simple_file: str, ): object_info, object_nodes = object_and_nodes - endpoint_without_object = list(set(self.cluster.cluster_nodes) - set(object_nodes))[ - 0 - ].storage_node.get_rpc_endpoint() + endpoint_without_object = list(set(self.cluster.cluster_nodes) - set(object_nodes))[0].storage_node.get_rpc_endpoint() endpoint_with_object = object_nodes[0].storage_node.get_rpc_endpoint() with reporter.step("Stop all nodes with object except first one"):