Skip background tests earlier if topology does not support

When the topology does not support background tests (either ping or
iperf), the tests are skipped. Before this patch, the stacks required by
these tests were created, despite not being used later, and this
was a waste of resources.

Change-Id: I60ef10276cf175d7d9cc3b5a2da54f221068acd1
This commit is contained in:
Eduardo Olivares 2025-03-13 16:58:58 +01:00
parent 2957ab5ed3
commit a2a36eee6e
3 changed files with 16 additions and 5 deletions

View File

@ -333,6 +333,8 @@ class OpenStackTopology(tobiko.SharedFixture):
neutron.SERVER: 'devstack@q-svc',
}
background_tests_supported = False
def __init__(self):
super(OpenStackTopology, self).__init__()
self._names: typing.Dict[str, OpenStackTopologyNode] = (

View File

@ -59,6 +59,8 @@ class RhospTopology(topology.OpenStackTopology):
has_containers = True
container_runtime_cmd = 'podman'
background_tests_supported = True
@property
def ignore_containers_list(self):
return None

View File

@ -68,6 +68,14 @@ class BackgroundProcessTest(BaseNetworkTest):
stack = tobiko.required_fixture(stacks.AdvancedPeerServerStackFixture)
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.topology = topology.get_openstack_topology()
if not cls.topology.background_tests_supported:
tobiko.skip_test(
'Background tests not supported by this topology class.')
def test_check_background_vm_ping(self):
""" Tests that are designed to run in the background ,
then collect results.
@ -75,7 +83,8 @@ class BackgroundProcessTest(BaseNetworkTest):
then execute some check logic i.e. a check function.
if the process by name isn't running,
start a separate process i.e a background function"""
topology.get_openstack_topology().check_or_start_background_vm_ping(
self.topology.check_or_start_background_vm_ping(
self.stack.peer_stack.floating_ip_address)
def test_east_west_tcp_traffic_background_iperf(self):
@ -86,8 +95,7 @@ class BackgroundProcessTest(BaseNetworkTest):
Traffic is send in the single flow using "iperf" tool.
"""
topology.get_openstack_topology().\
check_or_start_background_iperf_connection(
self.topology.check_or_start_background_iperf_connection(
self.stack.fixed_ipv4,
port=5203,
protocol='tcp',
@ -102,8 +110,7 @@ class BackgroundProcessTest(BaseNetworkTest):
Traffic is send in the single flow using "iperf" tool.
"""
topology.get_openstack_topology().\
check_or_start_background_iperf_connection(
self.topology.check_or_start_background_iperf_connection(
self.stack.peer_stack.floating_ip_address,
port=5204,
protocol='tcp',