diff --git a/tobiko/openstack/neutron/_agent.py b/tobiko/openstack/neutron/_agent.py index b5965b478..36d856df1 100644 --- a/tobiko/openstack/neutron/_agent.py +++ b/tobiko/openstack/neutron/_agent.py @@ -114,17 +114,25 @@ def skip_if_missing_networking_agents(binary: typing.Optional[str] = None, **params) +def skip_unless_missing_networking_agents( + binary: typing.Optional[str] = None, + count: int = 1, **params) \ + -> DecoratorType: + if binary is not None: + params['binary'] = binary + message = "found {return_value!r} agent(s)" + if params: + message += " with {!s}".format( + ', '.join("{!s}={!r}".format(k, v) for k, v in params.items())) + return tobiko.skip_unless(message, missing_networking_agents, count=count, + **params) + + def skip_unless_is_ovn(): - '''Skip the test if OVN is not configured''' - from tobiko.tripleo import overcloud - from tobiko.tripleo import containers - if overcloud.has_overcloud(): - message = "OVN is not configured" - return tobiko.skip_unless(message, containers.ovn_used_on_overcloud) - else: - return skip_if_missing_networking_agents(OVN_CONTROLLER) + """Skip the test if OVN is not configured""" + return skip_unless_missing_networking_agents(OPENVSWITCH_AGENT) def skip_unless_is_ovs(): - '''Skip the test if openvswitch agent does not exist''' + """Skip the test if openvswitch agent does exist""" return skip_if_missing_networking_agents(OPENVSWITCH_AGENT) diff --git a/tobiko/tests/scenario/neutron/test_nodes.py b/tobiko/tests/scenario/neutron/test_nodes.py index d5db46d11..4d48d35a4 100644 --- a/tobiko/tests/scenario/neutron/test_nodes.py +++ b/tobiko/tests/scenario/neutron/test_nodes.py @@ -21,10 +21,13 @@ from tobiko.openstack import neutron from tobiko.openstack import tests +@neutron.skip_unless_is_ovn() class NodeTest(testtools.TestCase): - @neutron.skip_unless_is_ovn() @pytest.mark.ovn_migration - def test_ovs_objects_are_absent_on_node(self): + def test_ovs_namespaces_are_absent(self): tests.test_ovs_namespaces_are_absent() + + @pytest.mark.ovn_migration + def test_ovs_interfaces_are_absent(self): tests.test_ovs_interfaces_are_absent()