Merge "Stop using OSP related assumption in non-osp test cases"

This commit is contained in:
Zuul 2021-07-16 18:26:18 +00:00 committed by Gerrit Code Review
commit 01f049d1e8
2 changed files with 22 additions and 11 deletions

View File

@ -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)

View File

@ -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()