Add decorator to skip test in case when DVR router is used
Some tests are valid only for centralized routers, so it adds a new decorator method skip_if_router_distributed to skip tests when router used in the NetworkStackFixture is DVR. It uses the new decorator in below test case: tobiko/tests/faults/neutron/test_ovs.py::OpenvswitchTest::test_recreate_physical_bridge Change-Id: I46128d5f76eef7428b765232c705b7b1a6b760d5
This commit is contained in:
parent
07d0d8a0eb
commit
2353dc2b01
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user