Merge "Make nova.tests.unit.virt pass with CONF.use_neutron=True by default"
This commit is contained in:
@@ -1495,6 +1495,8 @@ virConnect = Connection
|
||||
class FakeLibvirtFixture(fixtures.Fixture):
|
||||
"""Performs global setup/stubbing for all libvirt tests.
|
||||
"""
|
||||
def __init__(self, stub_os_vif=True):
|
||||
self.stub_os_vif = stub_os_vif
|
||||
|
||||
def setUp(self):
|
||||
super(FakeLibvirtFixture, self).setUp()
|
||||
@@ -1506,3 +1508,11 @@ class FakeLibvirtFixture(fixtures.Fixture):
|
||||
self.useFixture(fixtures.MonkeyPatch(i, sys.modules[__name__]))
|
||||
|
||||
disable_event_thread(self)
|
||||
|
||||
if self.stub_os_vif:
|
||||
# Make sure to never try and actually plug VIFs in os-vif unless
|
||||
# we're explicitly testing that code and the test itself will
|
||||
# handle the appropriate mocking.
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
'nova.virt.libvirt.vif.LibvirtGenericVIFDriver._plug_os_vif',
|
||||
lambda *a, **kw: None))
|
||||
|
||||
@@ -447,7 +447,7 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(LibvirtVifTestCase, self).setUp()
|
||||
self.useFixture(fakelibvirt.FakeLibvirtFixture())
|
||||
self.useFixture(fakelibvirt.FakeLibvirtFixture(stub_os_vif=False))
|
||||
self.flags(allow_same_net_traffic=True)
|
||||
# os_vif.initialize is typically done in nova-compute startup
|
||||
os_vif.initialize()
|
||||
|
||||
Reference in New Issue
Block a user