From 3f12bd75f6c02f90ee6d86cca0d3ed5fff37743a Mon Sep 17 00:00:00 2001 From: "a.y.volkov" Date: Wed, 20 Jul 2022 17:55:25 +0300 Subject: [PATCH] Add storage nodes health check before tests run Signed-off-by: a.y.volkov --- pytest_tests/testsuites/conftest.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index e0d0b98..625c8a6 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -9,11 +9,15 @@ from robot.api import deco import wallet from cli_helpers import _cmd_run -from common import ASSETS_DIR, FREE_STORAGE, MAINNET_WALLET_PATH +from common import ASSETS_DIR, FREE_STORAGE, MAINNET_WALLET_PATH, NEOFS_NETMAP_DICT from payment_neogo import neofs_deposit, transfer_mainnet_gas +from python_keywords.node_management import node_healthcheck + def robot_keyword_adapter(name=None, tags=(), types=()): return allure.step(name) + + deco.keyword = robot_keyword_adapter logger = logging.getLogger('NeoLogger') @@ -37,6 +41,19 @@ def check_binary_versions(request): out_file.write(f'{env}={env_value}\n') +@pytest.fixture(scope='session', autouse=True) +@allure.title('Run health check for all storage nodes') +def run_health_check(): + failed_nodes = [] + for node_name in NEOFS_NETMAP_DICT.keys(): + health_check = node_healthcheck(node_name) + if health_check.health_status != 'READY' or health_check.network_status != 'ONLINE': + failed_nodes.append(node_name) + + if failed_nodes: + raise AssertionError(f'Nodes {failed_nodes} are not healthy') + + @pytest.fixture(scope='session') @allure.title('Prepare tmp directory') def prepare_tmp_dir():