From be246596490418a944b0f5c860175cd093eb3035 Mon Sep 17 00:00:00 2001 From: Ilyas Niyazov Date: Fri, 13 Dec 2024 11:16:12 +0300 Subject: [PATCH] [#341] Fixed container metrics for tombstone --- .../metrics/test_container_metrics.py | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pytest_tests/testsuites/metrics/test_container_metrics.py b/pytest_tests/testsuites/metrics/test_container_metrics.py index 955e7b71..dec7c3ff 100644 --- a/pytest_tests/testsuites/metrics/test_container_metrics.py +++ b/pytest_tests/testsuites/metrics/test_container_metrics.py @@ -14,7 +14,7 @@ from frostfs_testlib.testing.cluster_test_base import ClusterTestBase from frostfs_testlib.testing.parallel import parallel from frostfs_testlib.utils.file_utils import TestFile, generate_file -from ...helpers.container_request import PUBLIC_WITH_POLICY, ContainerRequest, requires_container +from ...helpers.container_request import PUBLIC_WITH_POLICY, REP_2_1_4_PUBLIC, ContainerRequest, requires_container from ...helpers.utility import are_numbers_similar @@ -133,7 +133,7 @@ class TestContainerMetrics(ClusterTestBase): @allure.title("Container size metrics put {objects_count} objects (obj_size={object_size})") @pytest.mark.parametrize("objects_count", [5, 10, 20]) - @requires_container + @requires_container(REP_2_1_4_PUBLIC) def test_container_size_metrics_more_objects( self, object_size: ObjectSize, default_wallet: WalletInfo, objects_count: int, container: str ): @@ -161,13 +161,22 @@ class TestContainerMetrics(ClusterTestBase): tombstones_size += int(tombstone["header"]["payloadLength"]) with reporter.step(f"Check container size metrics, 'should be positive in all nodes'"): - futures = parallel( - get_metrics_value, self.cluster.cluster_nodes, command="frostfs_node_engine_container_size_bytes", cid=container - ) + with reporter.step("Search container nodes"): + container_nodes = search_nodes_with_container( + wallet=default_wallet, + cid=container, + shell=self.shell, + endpoint=self.cluster.default_rpc_endpoint, + cluster=self.cluster, + ) + with reporter.step(f"Get metrics value from container nodes"): + futures = parallel(get_metrics_value, container_nodes, command="frostfs_node_engine_container_size_bytes", cid=container) metrics_value_nodes = [future.result() for future in futures] for act_metric in metrics_value_nodes: assert act_metric >= 0, "Metrics value is negative" - assert sum(metrics_value_nodes) // len(self.cluster.cluster_nodes) == tombstones_size, "tomstone size of objects not correct" + + with reporter.step(f"Check container size metrics for tombstone"): + assert sum(metrics_value_nodes) // len(container_nodes) == tombstones_size, "tomstone size of objects not correct" @allure.title("Container metrics (policy={container_request})") @pytest.mark.parametrize(