diff --git a/pytest_tests/pytest.ini b/pytest_tests/pytest.ini index fa2cad1..0b0be95 100644 --- a/pytest_tests/pytest.ini +++ b/pytest_tests/pytest.ini @@ -10,6 +10,8 @@ markers = staging: test to be excluded from run in verifier/pr-validation/sanity jobs and run test in staging job sanity: test runs in sanity testrun smoke: test runs in smoke testrun +# controlling markers + no_healthcheck: skip healthcheck for this test # functional markers container: tests for container creation grpc_api: standard gRPC API tests diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 6bd729b..1dad1aa 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -22,11 +22,12 @@ from frostfs_testlib.steps.cli.container import list_containers from frostfs_testlib.steps.cli.object import get_netmap_netinfo from frostfs_testlib.steps.node_management import storage_node_healthcheck from frostfs_testlib.steps.s3 import s3_helper -from frostfs_testlib.storage.cluster import Cluster +from frostfs_testlib.storage.cluster import Cluster, ClusterNode from frostfs_testlib.storage.controllers.cluster_state_controller import ClusterStateController from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.wallet import WalletFactory, WalletInfo from frostfs_testlib.testing.cluster_test_base import ClusterTestBase +from frostfs_testlib.testing.parallel import parallel from frostfs_testlib.utils import env_utils, version_utils from pytest_tests.resources.common import HOSTING_CONFIG_FILE, TEST_CYCLES_COUNT @@ -268,17 +269,21 @@ def session_start_time(): return start_time -@allure.step("Run health check for all storage nodes") -@pytest.fixture(scope="session", autouse=True) -def run_health_check(session_start_time, cluster: Cluster): - failed_nodes = [] - for node in cluster.storage_nodes: - health_check = storage_node_healthcheck(node) - if health_check.health_status != "READY" or health_check.network_status != "ONLINE": - failed_nodes.append(node) +@allure.title("Run health check for all nodes") +@pytest.fixture(autouse=True) +def run_health_check(cluster: Cluster, request: pytest.FixtureRequest): + if request.node.get_closest_marker("no_healthcheck"): + # Skip healthcheck for tests marked with no_healthcheck + return + parallel(healthcheck_on_node, cluster.cluster_nodes) - if failed_nodes: - raise AssertionError(f"Nodes {failed_nodes} are not healthy") + +@allure.title("Run health check for {cluster_node}") +def healthcheck_on_node(cluster_node: ClusterNode): + health_check = storage_node_healthcheck(cluster_node.storage_node) + assert ( + health_check.health_status == "READY" and health_check.network_status == "ONLINE" + ), f"Node {cluster_node} is not healthy" @allure.step("Prepare wallet and deposit") diff --git a/pytest_tests/testsuites/special/test_logs.py b/pytest_tests/testsuites/special/test_logs.py index 080dad3..b8ca2e9 100644 --- a/pytest_tests/testsuites/special/test_logs.py +++ b/pytest_tests/testsuites/special/test_logs.py @@ -9,6 +9,7 @@ from frostfs_testlib.testing.cluster_test_base import ClusterTestBase class TestLogs(ClusterTestBase): @pytest.mark.logs_after_session + @pytest.mark.no_healthcheck def test_logs_after_session(self, temp_directory: str, session_start_time: datetime): """ This test automatically added to any test run to check logs from cluster for critical errors.