From 553fb1ec50f936dadce63185f7974bf142fa678c Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Mon, 27 Nov 2023 13:03:18 +0300 Subject: [PATCH] [#157] Move fixture Signed-off-by: Dmitriy Zayakin --- pytest_tests/testsuites/conftest.py | 9 +++++++++ pytest_tests/testsuites/failovers/conftest.py | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 0a145be..619ce29 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -1,5 +1,6 @@ import logging import os +import random import shutil from datetime import datetime, timedelta, timezone from importlib.metadata import entry_points @@ -382,3 +383,11 @@ def auth_container_placement_policy(cluster: Cluster, request: pytest.FixtureReq for key, value in placeholders.items(): placement_policy = placement_policy.replace(key, str(value)) return placement_policy + + +@pytest.fixture() +@allure.title("Select random node for testing") +def node_under_test(cluster: Cluster) -> ClusterNode: + selected_node = random.choice(cluster.cluster_nodes) + allure.attach(f"{selected_node}", "Selected node", allure.attachment_type.TEXT) + return selected_node diff --git a/pytest_tests/testsuites/failovers/conftest.py b/pytest_tests/testsuites/failovers/conftest.py index c5732c6..9f96568 100644 --- a/pytest_tests/testsuites/failovers/conftest.py +++ b/pytest_tests/testsuites/failovers/conftest.py @@ -1,23 +1,14 @@ import os -import random from datetime import datetime import allure import pytest -from frostfs_testlib.storage.cluster import Cluster, ClusterNode +from frostfs_testlib.storage.cluster import ClusterNode from frostfs_testlib.storage.controllers import ShardsWatcher from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.utils.file_utils import generate_file -@pytest.fixture() -@allure.title("Select random node for testing") -def node_under_test(cluster: Cluster) -> ClusterNode: - selected_node = random.choice(cluster.cluster_nodes) - allure.attach(f"{selected_node}", "Selected node", allure.attachment_type.TEXT) - return selected_node - - @pytest.fixture() @allure.title("Provide Shards watcher") def shards_watcher(node_under_test: ClusterNode) -> ShardsWatcher: