[#157] Move fixture

Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
Dmitriy Zayakin 2023-11-27 13:03:18 +03:00 committed by Dmitriy Zayakin
parent 858ca71e40
commit 553fb1ec50
2 changed files with 10 additions and 10 deletions

View file

@ -1,5 +1,6 @@
import logging import logging
import os import os
import random
import shutil import shutil
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
from importlib.metadata import entry_points 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(): for key, value in placeholders.items():
placement_policy = placement_policy.replace(key, str(value)) placement_policy = placement_policy.replace(key, str(value))
return placement_policy 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

View file

@ -1,23 +1,14 @@
import os import os
import random
from datetime import datetime from datetime import datetime
import allure import allure
import pytest 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.controllers import ShardsWatcher
from frostfs_testlib.storage.dataclasses.object_size import ObjectSize from frostfs_testlib.storage.dataclasses.object_size import ObjectSize
from frostfs_testlib.utils.file_utils import generate_file 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() @pytest.fixture()
@allure.title("Provide Shards watcher") @allure.title("Provide Shards watcher")
def shards_watcher(node_under_test: ClusterNode) -> ShardsWatcher: def shards_watcher(node_under_test: ClusterNode) -> ShardsWatcher: