From e40a40bf5bf25982de6f4e67d45a5cfd080c7d94 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 21 Nov 2024 12:30:59 +0100 Subject: [PATCH] Let topology to decide how to start background ping Previously background ping was implemented only for the tripleo topology and tests which were using it had to be skipped if were run on different topology. With this patch it is topology class who decides how background ping is going to be started. Currently it is only supported by the Tripleo topology and using undercloud to run background ping but in the future it will be supported also by the podified topology to run background ping in the POD. Related: #TOBIKO-100 Change-Id: Ie60d3d066509c5579474dec482f039a7713a41a0 --- tobiko/openstack/topology/_topology.py | 4 ++++ tobiko/tests/scenario/neutron/test_network.py | 6 ++---- tobiko/tripleo/_topology.py | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tobiko/openstack/topology/_topology.py b/tobiko/openstack/topology/_topology.py index 7c68002d4..09dc82856 100644 --- a/tobiko/openstack/topology/_topology.py +++ b/tobiko/openstack/topology/_topology.py @@ -650,6 +650,10 @@ class OpenStackTopology(tobiko.SharedFixture): ip_version=self.ip_version, ssh_config=True) + def check_or_start_background_vm_ping(self): + tobiko.skip_test("Background ping not supported by " + "this topology class.") + def get_openstack_topology(topology_class: typing.Type = None) -> \ OpenStackTopology: diff --git a/tobiko/tests/scenario/neutron/test_network.py b/tobiko/tests/scenario/neutron/test_network.py index d27adb86f..cc2c2dcae 100644 --- a/tobiko/tests/scenario/neutron/test_network.py +++ b/tobiko/tests/scenario/neutron/test_network.py @@ -21,10 +21,9 @@ import tobiko from tobiko.openstack import neutron from tobiko.openstack import nova from tobiko.openstack import stacks +from tobiko.openstack import topology from tobiko.shell import ping from tobiko.shell import sh -from tobiko.tripleo import undercloud -from tobiko.tripleo import nova as tripleo_nova @pytest.mark.minimal @@ -62,7 +61,6 @@ class NetworkTest(testtools.TestCase): @pytest.mark.background -@undercloud.skip_if_missing_undercloud class BackgroundProcessTest(NetworkTest): def test_check_background_vm_ping(self): @@ -72,7 +70,7 @@ class BackgroundProcessTest(NetworkTest): 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""" - tripleo_nova.check_or_start_background_vm_ping() + topology.get_openstack_topology().check_or_start_background_vm_ping() @pytest.mark.migrate_server diff --git a/tobiko/tripleo/_topology.py b/tobiko/tripleo/_topology.py index 6949874d1..cdd887c81 100644 --- a/tobiko/tripleo/_topology.py +++ b/tobiko/tripleo/_topology.py @@ -32,6 +32,7 @@ from tobiko.shell import ssh from tobiko.tripleo import _overcloud from tobiko.tripleo import _undercloud from tobiko.tripleo import containers +from tobiko.tripleo import nova as tripleo_nova CONF = config.CONF LOG = log.getLogger(__name__) @@ -187,6 +188,9 @@ class TripleoTopology(rhosp.RhospTopology): "name: '%s'", node.name) return subgroups + def check_or_start_background_vm_ping(self): + tripleo_nova.check_or_start_background_vm_ping() + class TripleoTopologyNode(rhosp.RhospNode):