From 67492452063d01a38188d70844aa2a7b899b2ac3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zayakin Date: Wed, 25 Oct 2023 15:56:59 +0300 Subject: [PATCH] Add fixture skip test interfaces Signed-off-by: Dmitriy Zayakin --- pytest_tests/testsuites/conftest.py | 13 +++++++++++++ .../testsuites/failovers/test_failover_network.py | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 3fd97ed0..559778d3 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -105,6 +105,19 @@ def require_multiple_hosts(hosting: Hosting): yield +@pytest.fixture(scope="session") +def require_multiple_interfaces(cluster: Cluster): + """ + We determine that there are the required number of interfaces for tests + + If there are no required interfaces, the tests will be skipped. + """ + interfaces = cluster.cluster_nodes[0].host.config.interfaces + if "internal1" not in interfaces or "data1" not in interfaces: + pytest.skip("This test requires multiple internal and data interfaces") + yield + + @pytest.fixture(scope="session") def max_object_size(cluster: Cluster, client_shell: Shell) -> int: storage_node = cluster.storage_nodes[0] diff --git a/pytest_tests/testsuites/failovers/test_failover_network.py b/pytest_tests/testsuites/failovers/test_failover_network.py index 7bd911f8..5211796e 100644 --- a/pytest_tests/testsuites/failovers/test_failover_network.py +++ b/pytest_tests/testsuites/failovers/test_failover_network.py @@ -336,7 +336,7 @@ class TestFailoverNetwork(ClusterTestBase): self.tick_epochs(1, alive_node=nodes_without_an_object[0].storage_node, wait_block=2) @pytest.mark.interfaces - @pytest.mark.baremetal + @pytest.mark.failover_baremetal @pytest.mark.parametrize( "block_interface, other_interface", [(Interfaces.DATA_O, Interfaces.DATA_1), (Interfaces.DATA_1, Interfaces.DATA_O)], @@ -344,6 +344,7 @@ class TestFailoverNetwork(ClusterTestBase): @allure.title("Down data interfaces to all nodes(interface={block_interface})") def test_down_data_interface( self, + require_multiple_interfaces, cluster_state_controller: ClusterStateController, default_wallet: str, simple_object_size: ObjectSize, @@ -394,11 +395,12 @@ class TestFailoverNetwork(ClusterTestBase): self.tick_epochs(1, alive_node=cluster_nodes[0].storage_node, wait_block=2) @pytest.mark.interfaces - @pytest.mark.baremetal + @pytest.mark.failover_baremetal @pytest.mark.parametrize("interface", [Interfaces.INTERNAL_0, Interfaces.INTERNAL_1]) @allure.title("Down internal interfaces to all nodes(interface={interface})") def test_down_internal_interface( self, + require_multiple_interfaces, cluster_state_controller: ClusterStateController, default_wallet: str, simple_object_size: ObjectSize,