[#96] Move healthcheck to function level #96

Merged
abereziny merged 1 commit from abereziny/frostfs-testcases:feature-move-healthcheck-to-function-level into master 2023-10-02 07:49:40 +00:00
3 changed files with 19 additions and 11 deletions

View file

@ -10,6 +10,8 @@ markers =
staging: test to be excluded from run in verifier/pr-validation/sanity jobs and run test in staging job 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 sanity: test runs in sanity testrun
smoke: test runs in smoke testrun smoke: test runs in smoke testrun
# controlling markers
no_healthcheck: skip healthcheck for this test
# functional markers # functional markers
container: tests for container creation container: tests for container creation
grpc_api: standard gRPC API tests grpc_api: standard gRPC API tests

View file

@ -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.cli.object import get_netmap_netinfo
from frostfs_testlib.steps.node_management import storage_node_healthcheck from frostfs_testlib.steps.node_management import storage_node_healthcheck
from frostfs_testlib.steps.s3 import s3_helper 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.controllers.cluster_state_controller import ClusterStateController
from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.object_size import ObjectSize
from frostfs_testlib.storage.dataclasses.wallet import WalletFactory, WalletInfo from frostfs_testlib.storage.dataclasses.wallet import WalletFactory, WalletInfo
from frostfs_testlib.testing.cluster_test_base import ClusterTestBase 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 frostfs_testlib.utils import env_utils, version_utils
from pytest_tests.resources.common import HOSTING_CONFIG_FILE, TEST_CYCLES_COUNT from pytest_tests.resources.common import HOSTING_CONFIG_FILE, TEST_CYCLES_COUNT
@ -268,17 +269,21 @@ def session_start_time():
return start_time return start_time
@allure.step("Run health check for all storage nodes") @allure.title("Run health check for all nodes")
@pytest.fixture(scope="session", autouse=True) @pytest.fixture(autouse=True)
def run_health_check(session_start_time, cluster: Cluster): def run_health_check(cluster: Cluster, request: pytest.FixtureRequest):
failed_nodes = [] if request.node.get_closest_marker("no_healthcheck"):
for node in cluster.storage_nodes: # Skip healthcheck for tests marked with no_healthcheck
health_check = storage_node_healthcheck(node) return
if health_check.health_status != "READY" or health_check.network_status != "ONLINE": parallel(healthcheck_on_node, cluster.cluster_nodes)
failed_nodes.append(node)
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") @allure.step("Prepare wallet and deposit")

View file

@ -9,6 +9,7 @@ from frostfs_testlib.testing.cluster_test_base import ClusterTestBase
class TestLogs(ClusterTestBase): class TestLogs(ClusterTestBase):
@pytest.mark.logs_after_session @pytest.mark.logs_after_session
@pytest.mark.no_healthcheck
def test_logs_after_session(self, temp_directory: str, session_start_time: datetime): 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. This test automatically added to any test run to check logs from cluster for critical errors.