Merge "Add decorator to skip test in case when DVR router is used"

This commit is contained in:
Zuul 2021-09-04 01:30:31 +00:00 committed by Gerrit Code Review
commit 2697c239a6
2 changed files with 18 additions and 1 deletions

View File

@ -291,6 +291,21 @@ class NetworkStackFixture(heat.HeatStackFixture):
requirements['router'] += 1
return requirements
def is_router_distributed(self) -> bool:
if self.has_gateway:
tobiko.setup_fixture(self)
return bool(self.gateway_details.get('distributed'))
else:
return False
@classmethod
def skip_if_router_is_distributed(cls, reason: str = None):
fixture = tobiko.get_fixture(cls)
if reason is None:
reason = "Distributed router is not supported"
return tobiko.skip_if(reason=reason,
predicate=fixture.is_router_distributed)
@neutron.skip_if_missing_networking_extensions('net-mtu-writable')
class NetworkWithNetMtuWriteStackFixture(NetworkStackFixture):

View File

@ -31,7 +31,8 @@ from tobiko.tripleo import undercloud
@neutron.skip_if_missing_networking_agents(neutron.L3_AGENT)
class OpenvswitchTest(testtools.TestCase):
stack = tobiko.required_setup_fixture(stacks.CirrosServerStackFixture)
stack: stacks.ServerStackFixture = tobiko.required_fixture(
stacks.CirrosServerStackFixture)
def setUp(self):
super(OpenvswitchTest, self).setUp()
@ -72,6 +73,7 @@ class OpenvswitchTest(testtools.TestCase):
raise neutron.AgentNotFoundOnHost(agent_type="neutron-ovs-agent",
host=hostname)
@stacks.NetworkStackFixture.skip_if_router_is_distributed()
@undercloud.skip_if_missing_undercloud
def test_recreate_physical_bridge(self):
# Check if vm is reachable before test