Merge "unit: consolidate mocking start_odl_sync_thread"
This commit is contained in:
commit
48f8209195
|
@ -22,6 +22,8 @@ from oslo_config import cfg
|
||||||
from networking_odl.common import odl_features
|
from networking_odl.common import odl_features
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
|
from networking_odl.journal import journal
|
||||||
|
|
||||||
|
|
||||||
class DietTestCase(base.DietTestCase):
|
class DietTestCase(base.DietTestCase):
|
||||||
|
|
||||||
|
@ -75,3 +77,10 @@ class OpenDaylightFeaturesFixture(fixtures.Fixture):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fake_init():
|
def fake_init():
|
||||||
odl_features.feature_set = set()
|
odl_features.feature_set = set()
|
||||||
|
|
||||||
|
|
||||||
|
class OpenDaylightJournalThreadFixture(fixtures.Fixture):
|
||||||
|
def _setUp(self):
|
||||||
|
super(OpenDaylightJournalThreadFixture, self)._setUp()
|
||||||
|
mock.patch.object(journal.OpenDaylightJournalThread,
|
||||||
|
'start_odl_sync_thread').start()
|
||||||
|
|
|
@ -35,8 +35,7 @@ class OpenDaylightConfigBase(test_plugin.Ml2PluginV2TestCase,
|
||||||
['logger', 'opendaylight_v2'], 'ml2')
|
['logger', 'opendaylight_v2'], 'ml2')
|
||||||
cfg.CONF.set_override('extension_drivers',
|
cfg.CONF.set_override('extension_drivers',
|
||||||
['port_security', 'qos'], 'ml2')
|
['port_security', 'qos'], 'ml2')
|
||||||
self.mock_sync_thread = mock.patch.object(
|
self.useFixture(base.OpenDaylightJournalThreadFixture())
|
||||||
journal.OpenDaylightJournalThread, 'start_odl_sync_thread').start()
|
|
||||||
self.mock_mt_thread = mock.patch.object(
|
self.mock_mt_thread = mock.patch.object(
|
||||||
maintenance.MaintenanceThread, 'start').start()
|
maintenance.MaintenanceThread, 'start').start()
|
||||||
self.thread = journal.OpenDaylightJournalThread()
|
self.thread = journal.OpenDaylightJournalThread()
|
||||||
|
|
|
@ -111,8 +111,7 @@ class OpenDaylightL3TestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase,
|
||||||
cfg.CONF.set_override("service_plugins", ['odl-router_v2'])
|
cfg.CONF.set_override("service_plugins", ['odl-router_v2'])
|
||||||
core_plugin = cfg.CONF.core_plugin
|
core_plugin = cfg.CONF.core_plugin
|
||||||
service_plugins = {'l3_plugin_name': 'odl-router_v2'}
|
service_plugins = {'l3_plugin_name': 'odl-router_v2'}
|
||||||
mock.patch.object(journal.OpenDaylightJournalThread,
|
self.useFixture(odl_base.OpenDaylightJournalThreadFixture())
|
||||||
'start_odl_sync_thread').start()
|
|
||||||
self.mock_mt_thread = mock.patch.object(
|
self.mock_mt_thread = mock.patch.object(
|
||||||
maintenance.MaintenanceThread, 'start').start()
|
maintenance.MaintenanceThread, 'start').start()
|
||||||
mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,
|
mock.patch.object(mech_driver_v2.OpenDaylightMechanismDriver,
|
||||||
|
|
|
@ -43,7 +43,7 @@ from networking_odl.journal import cleanup
|
||||||
from networking_odl.journal import journal
|
from networking_odl.journal import journal
|
||||||
from networking_odl.journal import maintenance
|
from networking_odl.journal import maintenance
|
||||||
from networking_odl.ml2 import mech_driver_v2
|
from networking_odl.ml2 import mech_driver_v2
|
||||||
from networking_odl.tests import base as odl_base
|
from networking_odl.tests import base
|
||||||
from networking_odl.tests.unit import base_v2
|
from networking_odl.tests.unit import base_v2
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,15 +60,14 @@ SG_RULE_FAKE_ID = uuidutils.generate_uuid()
|
||||||
class OpenDayLightMechanismConfigTests(testlib_api.SqlTestCase):
|
class OpenDayLightMechanismConfigTests(testlib_api.SqlTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(OpenDayLightMechanismConfigTests, self).setUp()
|
super(OpenDayLightMechanismConfigTests, self).setUp()
|
||||||
self.mock_sync_thread = mock.patch.object(
|
self.useFixture(base.OpenDaylightJournalThreadFixture())
|
||||||
journal.OpenDaylightJournalThread, 'start_odl_sync_thread').start()
|
|
||||||
self.mock_mt_thread = mock.patch.object(
|
self.mock_mt_thread = mock.patch.object(
|
||||||
maintenance.MaintenanceThread, 'start').start()
|
maintenance.MaintenanceThread, 'start').start()
|
||||||
cfg.CONF.set_override('mechanism_drivers',
|
cfg.CONF.set_override('mechanism_drivers',
|
||||||
['logger', 'opendaylight_v2'], 'ml2')
|
['logger', 'opendaylight_v2'], 'ml2')
|
||||||
cfg.CONF.set_override('port_binding_controller',
|
cfg.CONF.set_override('port_binding_controller',
|
||||||
'legacy-port-binding', 'ml2_odl')
|
'legacy-port-binding', 'ml2_odl')
|
||||||
self.useFixture(odl_base.OpenDaylightFeaturesFixture())
|
self.useFixture(base.OpenDaylightFeaturesFixture())
|
||||||
|
|
||||||
def _set_config(self, url='http://127.0.0.1:9999', username='someuser',
|
def _set_config(self, url='http://127.0.0.1:9999', username='someuser',
|
||||||
password='somepass'):
|
password='somepass'):
|
||||||
|
@ -156,7 +155,9 @@ class AttributeDict(dict):
|
||||||
class OpenDaylightMechanismDriverTestCase(base_v2.OpenDaylightConfigBase):
|
class OpenDaylightMechanismDriverTestCase(base_v2.OpenDaylightConfigBase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(OpenDaylightMechanismDriverTestCase, self).setUp()
|
super(OpenDaylightMechanismDriverTestCase, self).setUp()
|
||||||
self.useFixture(odl_base.OpenDaylightFeaturesFixture())
|
self.useFixture(base.OpenDaylightFeaturesFixture())
|
||||||
|
self.mock_sync_thread = mock.patch.object(
|
||||||
|
journal.OpenDaylightJournalThread, 'start_odl_sync_thread').start()
|
||||||
self.db_session = neutron_db_api.get_writer_session()
|
self.db_session = neutron_db_api.get_writer_session()
|
||||||
self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
|
self.mech = mech_driver_v2.OpenDaylightMechanismDriver()
|
||||||
self.mech.initialize()
|
self.mech.initialize()
|
||||||
|
|
|
@ -18,8 +18,8 @@ from neutron.db import api as neutron_db_api
|
||||||
|
|
||||||
from networking_odl.common import constants as odl_const
|
from networking_odl.common import constants as odl_const
|
||||||
from networking_odl.db import db
|
from networking_odl.db import db
|
||||||
from networking_odl.journal import journal
|
|
||||||
from networking_odl.qos import qos_driver_v2 as qos_driver
|
from networking_odl.qos import qos_driver_v2 as qos_driver
|
||||||
|
from networking_odl.tests import base
|
||||||
from networking_odl.tests.unit import base_v2
|
from networking_odl.tests.unit import base_v2
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ class OpenDaylightQosDriverTestCase(base_v2.OpenDaylightConfigBase):
|
||||||
super(OpenDaylightQosDriverTestCase, self).setUp()
|
super(OpenDaylightQosDriverTestCase, self).setUp()
|
||||||
self.db_session = neutron_db_api.get_writer_session()
|
self.db_session = neutron_db_api.get_writer_session()
|
||||||
self.qos_driver = qos_driver.OpenDaylightQosDriver()
|
self.qos_driver = qos_driver.OpenDaylightQosDriver()
|
||||||
self.mock_sync_thread = mock.patch.object(
|
self.useFixture(base.OpenDaylightJournalThreadFixture())
|
||||||
journal.OpenDaylightJournalThread, 'start_odl_sync_thread').start()
|
|
||||||
|
|
||||||
def _get_mock_context(self):
|
def _get_mock_context(self):
|
||||||
current = {'tenant_id': 'tenant_id'}
|
current = {'tenant_id': 'tenant_id'}
|
||||||
|
|
Loading…
Reference in New Issue