Merge "Remove individual cfg.CONF.resets from tests"
This commit is contained in:
commit
27680cb6c2
@ -18,7 +18,6 @@
|
|||||||
# @author: Abhishek Raut, Cisco Systems Inc.
|
# @author: Abhishek Raut, Cisco Systems Inc.
|
||||||
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron.api import extensions as neutron_extensions
|
from neutron.api import extensions as neutron_extensions
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
@ -201,7 +200,6 @@ class N1kvPluginTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
n1kv_neutron_plugin.N1kvNeutronPluginV2._setup_vsm = _fake_setup_vsm
|
n1kv_neutron_plugin.N1kvNeutronPluginV2._setup_vsm = _fake_setup_vsm
|
||||||
|
|
||||||
neutron_extensions.append_api_extensions_path(extensions.__path__)
|
neutron_extensions.append_api_extensions_path(extensions.__path__)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
ext_mgr = NetworkProfileTestExtensionManager()
|
ext_mgr = NetworkProfileTestExtensionManager()
|
||||||
|
|
||||||
# Save the original RESOURCE_ATTRIBUTE_MAP
|
# Save the original RESOURCE_ATTRIBUTE_MAP
|
||||||
|
@ -101,7 +101,6 @@ class CiscoNetworkPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
|||||||
for group in config[module]:
|
for group in config[module]:
|
||||||
for opt, val in config[module][group].items():
|
for opt, val in config[module][group].items():
|
||||||
module.cfg.CONF.set_override(opt, val, group)
|
module.cfg.CONF.set_override(opt, val, group)
|
||||||
self.addCleanup(module.cfg.CONF.reset)
|
|
||||||
|
|
||||||
# Configure the Nexus switch dictionary
|
# Configure the Nexus switch dictionary
|
||||||
# TODO(Henry): add tests for other devices
|
# TODO(Henry): add tests for other devices
|
||||||
@ -1016,7 +1015,6 @@ class TestCiscoRouterInterfacesV2(CiscoNetworkPluginV2TestCase):
|
|||||||
super(TestCiscoRouterInterfacesV2, self).setUp()
|
super(TestCiscoRouterInterfacesV2, self).setUp()
|
||||||
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
|
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
|
||||||
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
|
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
|
||||||
self.addCleanup(cisco_config.CONF.reset)
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _network_subnet_router(self):
|
def _network_subnet_router(self):
|
||||||
|
@ -189,7 +189,6 @@ class TestCiscoNexusPlugin(base.BaseTestCase):
|
|||||||
'provider_vlan_auto_create', auto_create, 'CISCO')
|
'provider_vlan_auto_create', auto_create, 'CISCO')
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'provider_vlan_auto_trunk', auto_trunk, 'CISCO')
|
'provider_vlan_auto_trunk', auto_trunk, 'CISCO')
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
with mock.patch.object(cdb, 'is_provider_vlan',
|
with mock.patch.object(cdb, 'is_provider_vlan',
|
||||||
return_value=True) as mock_db:
|
return_value=True) as mock_db:
|
||||||
# Create a provider network
|
# Create a provider network
|
||||||
|
@ -36,8 +36,6 @@ class TestCiscoPluginModel(base.BaseTestCase):
|
|||||||
|
|
||||||
super(TestCiscoPluginModel, self).setUp()
|
super(TestCiscoPluginModel, self).setUp()
|
||||||
|
|
||||||
self.addCleanup(cisco_config.CONF.reset)
|
|
||||||
|
|
||||||
def test_non_nexus_device_driver(self):
|
def test_non_nexus_device_driver(self):
|
||||||
"""Tests handling of an non-Nexus device driver being configured."""
|
"""Tests handling of an non-Nexus device driver being configured."""
|
||||||
with mock.patch.dict(sys.modules, {'mock_driver': mock.Mock()}):
|
with mock.patch.dict(sys.modules, {'mock_driver': mock.Mock()}):
|
||||||
|
@ -352,15 +352,11 @@ class LoadBalancerPluginDbTestCase(LoadBalancerTestMixin,
|
|||||||
mock_lbaas_agent = mock.MagicMock()
|
mock_lbaas_agent = mock.MagicMock()
|
||||||
get_lbaas_agent_patcher.start().return_value = mock_lbaas_agent
|
get_lbaas_agent_patcher.start().return_value = mock_lbaas_agent
|
||||||
mock_lbaas_agent.__getitem__.return_value = {'host': 'host'}
|
mock_lbaas_agent.__getitem__.return_value = {'host': 'host'}
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
self._subnet_id = _subnet_id
|
self._subnet_id = _subnet_id
|
||||||
|
|
||||||
|
|
||||||
class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
||||||
def setUp(self):
|
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
super(TestLoadBalancer, self).setUp()
|
|
||||||
|
|
||||||
def test_create_vip(self, **extras):
|
def test_create_vip(self, **extras):
|
||||||
expected = {
|
expected = {
|
||||||
|
@ -37,7 +37,6 @@ class TestEmbraneL3NatDBTestCase(router_test.L3NatDBIntTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(db.clear_db)
|
self.addCleanup(db.clear_db)
|
||||||
super(TestEmbraneL3NatDBTestCase, self).setUp()
|
super(TestEmbraneL3NatDBTestCase, self).setUp()
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ class EmbranePluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
cfg.CONF.set_override('admin_password', "admin123", 'heleos')
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(db.clear_db)
|
self.addCleanup(db.clear_db)
|
||||||
super(EmbranePluginV2TestCase, self).setUp(self._plugin_name)
|
super(EmbranePluginV2TestCase, self).setUp(self._plugin_name)
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestHyperVNeutronAgent, self).setUp()
|
super(TestHyperVNeutronAgent, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
# Avoid rpc initialization for unit tests
|
# Avoid rpc initialization for unit tests
|
||||||
cfg.CONF.set_override('rpc_backend',
|
cfg.CONF.set_override('rpc_backend',
|
||||||
'neutron.openstack.common.rpc.impl_fake')
|
'neutron.openstack.common.rpc.impl_fake')
|
||||||
|
@ -37,14 +37,12 @@ class CreateAgentConfigMap(base.BaseTestCase):
|
|||||||
self.assertTrue(sdnve_neutron_agent.create_agent_config_map(cfg.CONF))
|
self.assertTrue(sdnve_neutron_agent.create_agent_config_map(cfg.CONF))
|
||||||
|
|
||||||
def test_create_agent_config_using_controller_ips(self):
|
def test_create_agent_config_using_controller_ips(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('controller_ips',
|
cfg.CONF.set_override('controller_ips',
|
||||||
['10.10.10.1', '10.10.10.2'], group='SDNVE')
|
['10.10.10.1', '10.10.10.2'], group='SDNVE')
|
||||||
cfgmap = sdnve_neutron_agent.create_agent_config_map(cfg.CONF)
|
cfgmap = sdnve_neutron_agent.create_agent_config_map(cfg.CONF)
|
||||||
self.assertEqual(cfgmap['controller_ip'], '10.10.10.1')
|
self.assertEqual(cfgmap['controller_ip'], '10.10.10.1')
|
||||||
|
|
||||||
def test_create_agent_config_using_interface_mappings(self):
|
def test_create_agent_config_using_interface_mappings(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('interface_mappings',
|
cfg.CONF.set_override('interface_mappings',
|
||||||
['interface1 : eth1', 'interface2 : eth2'],
|
['interface1 : eth1', 'interface2 : eth2'],
|
||||||
group='SDNVE')
|
group='SDNVE')
|
||||||
@ -57,7 +55,6 @@ class TestSdnveNeutronAgent(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestSdnveNeutronAgent, self).setUp()
|
super(TestSdnveNeutronAgent, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
notifier_p = mock.patch(NOTIFIER)
|
notifier_p = mock.patch(NOTIFIER)
|
||||||
notifier_cls = notifier_p.start()
|
notifier_cls = notifier_p.start()
|
||||||
self.notifier = mock.Mock()
|
self.notifier = mock.Mock()
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.ibm.common import constants
|
from neutron.plugins.ibm.common import constants
|
||||||
@ -37,7 +36,6 @@ class TestSdnveApi(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestSdnveApi, self).setUp()
|
super(TestSdnveApi, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
class MockKeystoneClient(object):
|
class MockKeystoneClient(object):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
@ -48,7 +48,6 @@ class TestLinuxBridge(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestLinuxBridge, self).setUp()
|
super(TestLinuxBridge, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
interface_mappings = {'physnet1': 'eth1'}
|
interface_mappings = {'physnet1': 'eth1'}
|
||||||
root_helper = cfg.CONF.AGENT.root_helper
|
root_helper = cfg.CONF.AGENT.root_helper
|
||||||
|
|
||||||
@ -753,7 +752,6 @@ class TestLinuxBridgeManager(base.BaseTestCase):
|
|||||||
class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):
|
class TestLinuxBridgeRpcCallbacks(base.BaseTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
cfg.CONF.set_override('local_ip', LOCAL_IP, 'VXLAN')
|
cfg.CONF.set_override('local_ip', LOCAL_IP, 'VXLAN')
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
super(TestLinuxBridgeRpcCallbacks, self).setUp()
|
super(TestLinuxBridgeRpcCallbacks, self).setUp()
|
||||||
|
|
||||||
self.u_execute_p = mock.patch('neutron.agent.linux.utils.execute')
|
self.u_execute_p = mock.patch('neutron.agent.linux.utils.execute')
|
||||||
|
@ -45,8 +45,6 @@ class TestBrocadeMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase):
|
|||||||
for opt, val in ml2_opts.items():
|
for opt, val in ml2_opts.items():
|
||||||
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
||||||
|
|
||||||
self.addCleanup(ml2_config.cfg.CONF.reset)
|
|
||||||
|
|
||||||
def mocked_brocade_init(self):
|
def mocked_brocade_init(self):
|
||||||
self._driver = mock.MagicMock()
|
self._driver = mock.MagicMock()
|
||||||
|
|
||||||
|
@ -72,14 +72,12 @@ class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
|||||||
}
|
}
|
||||||
for opt, val in ml2_opts.items():
|
for opt, val in ml2_opts.items():
|
||||||
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
||||||
self.addCleanup(ml2_config.cfg.CONF.reset)
|
|
||||||
|
|
||||||
# Configure the ML2 VLAN parameters
|
# Configure the ML2 VLAN parameters
|
||||||
phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)])
|
phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)])
|
||||||
vlan_config.cfg.CONF.set_override('network_vlan_ranges',
|
vlan_config.cfg.CONF.set_override('network_vlan_ranges',
|
||||||
[phys_vrange],
|
[phys_vrange],
|
||||||
'ml2_type_vlan')
|
'ml2_type_vlan')
|
||||||
self.addCleanup(vlan_config.cfg.CONF.reset)
|
|
||||||
|
|
||||||
# Configure the Cisco Nexus mechanism driver
|
# Configure the Cisco Nexus mechanism driver
|
||||||
nexus_config = {
|
nexus_config = {
|
||||||
|
@ -46,14 +46,12 @@ class TestBigSwitchMechDriverBase(trp.BigSwitchProxyPluginV2TestCase):
|
|||||||
}
|
}
|
||||||
for opt, val in ml2_opts.items():
|
for opt, val in ml2_opts.items():
|
||||||
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
||||||
self.addCleanup(ml2_config.cfg.CONF.reset)
|
|
||||||
|
|
||||||
# Configure the ML2 VLAN parameters
|
# Configure the ML2 VLAN parameters
|
||||||
phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)])
|
phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)])
|
||||||
vlan_config.cfg.CONF.set_override('network_vlan_ranges',
|
vlan_config.cfg.CONF.set_override('network_vlan_ranges',
|
||||||
[phys_vrange],
|
[phys_vrange],
|
||||||
'ml2_type_vlan')
|
'ml2_type_vlan')
|
||||||
self.addCleanup(vlan_config.cfg.CONF.reset)
|
|
||||||
super(TestBigSwitchMechDriverBase,
|
super(TestBigSwitchMechDriverBase,
|
||||||
self).setUp(ML2_PLUGIN)
|
self).setUp(ML2_PLUGIN)
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
'l2population'],
|
'l2population'],
|
||||||
'ml2')
|
'ml2')
|
||||||
super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME)
|
super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME)
|
||||||
self.addCleanup(config.cfg.CONF.reset)
|
|
||||||
|
|
||||||
self.adminContext = context.get_admin_context()
|
self.adminContext = context.get_admin_context()
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ class NCSTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
config.cfg.CONF.set_override('mechanism_drivers',
|
config.cfg.CONF.set_override('mechanism_drivers',
|
||||||
['logger', 'ncs'],
|
['logger', 'ncs'],
|
||||||
'ml2')
|
'ml2')
|
||||||
self.addCleanup(config.cfg.CONF.reset)
|
|
||||||
super(NCSTestCase, self).setUp(PLUGIN_NAME)
|
super(NCSTestCase, self).setUp(PLUGIN_NAME)
|
||||||
self.port_create_status = 'DOWN'
|
self.port_create_status = 'DOWN'
|
||||||
mechanism_ncs.NCSMechanismDriver.sendjson = self.check_sendjson
|
mechanism_ncs.NCSMechanismDriver.sendjson = self.check_sendjson
|
||||||
|
@ -57,7 +57,6 @@ class Ml2PluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
self.phys_vrange = ':'.join([self.physnet, self.vlan_range])
|
self.phys_vrange = ':'.join([self.physnet, self.vlan_range])
|
||||||
config.cfg.CONF.set_override('network_vlan_ranges', [self.phys_vrange],
|
config.cfg.CONF.set_override('network_vlan_ranges', [self.phys_vrange],
|
||||||
group='ml2_type_vlan')
|
group='ml2_type_vlan')
|
||||||
self.addCleanup(config.cfg.CONF.reset)
|
|
||||||
super(Ml2PluginV2TestCase, self).setUp(PLUGIN_NAME,
|
super(Ml2PluginV2TestCase, self).setUp(PLUGIN_NAME,
|
||||||
service_plugins=service_plugins)
|
service_plugins=service_plugins)
|
||||||
self.port_create_status = 'DOWN'
|
self.port_create_status = 'DOWN'
|
||||||
|
@ -36,7 +36,6 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
|||||||
config.cfg.CONF.set_override('mechanism_drivers',
|
config.cfg.CONF.set_override('mechanism_drivers',
|
||||||
['logger', 'test'],
|
['logger', 'test'],
|
||||||
'ml2')
|
'ml2')
|
||||||
self.addCleanup(config.cfg.CONF.reset)
|
|
||||||
super(PortBindingTestCase, self).setUp(PLUGIN_NAME)
|
super(PortBindingTestCase, self).setUp(PLUGIN_NAME)
|
||||||
self.port_create_status = 'DOWN'
|
self.port_create_status = 'DOWN'
|
||||||
self.plugin = manager.NeutronManager.get_plugin()
|
self.plugin = manager.NeutronManager.get_plugin()
|
||||||
|
@ -50,7 +50,6 @@ class VxlanTypeTest(base.BaseTestCase):
|
|||||||
self.driver.vxlan_vni_ranges = TUNNEL_RANGES
|
self.driver.vxlan_vni_ranges = TUNNEL_RANGES
|
||||||
self.driver._sync_vxlan_allocations()
|
self.driver._sync_vxlan_allocations()
|
||||||
self.session = db.get_session()
|
self.session = db.get_session()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(db.clear_db)
|
self.addCleanup(db.clear_db)
|
||||||
|
|
||||||
def test_vxlan_tunnel_type(self):
|
def test_vxlan_tunnel_type(self):
|
||||||
|
@ -37,7 +37,6 @@ class TestNecAgentBase(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestNecAgentBase, self).setUp()
|
super(TestNecAgentBase, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('rpc_backend',
|
cfg.CONF.set_override('rpc_backend',
|
||||||
'neutron.openstack.common.rpc.impl_fake')
|
'neutron.openstack.common.rpc.impl_fake')
|
||||||
cfg.CONF.set_override('host', 'dummy-host')
|
cfg.CONF.set_override('host', 'dummy-host')
|
||||||
|
@ -33,7 +33,6 @@ class TestOneConvergenceAgentBase(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestOneConvergenceAgentBase, self).setUp()
|
super(TestOneConvergenceAgentBase, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('rpc_backend',
|
cfg.CONF.set_override('rpc_backend',
|
||||||
'neutron.openstack.common.rpc.impl_fake')
|
'neutron.openstack.common.rpc.impl_fake')
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
|
@ -41,7 +41,6 @@ class CreateAgentConfigMap(base.BaseTestCase):
|
|||||||
self.assertTrue(ovs_neutron_agent.create_agent_config_map(cfg.CONF))
|
self.assertTrue(ovs_neutron_agent.create_agent_config_map(cfg.CONF))
|
||||||
|
|
||||||
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
|
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
# An ip address is required for tunneling but there is no default,
|
# An ip address is required for tunneling but there is no default,
|
||||||
# verify this for both gre and vxlan tunnels.
|
# verify this for both gre and vxlan tunnels.
|
||||||
cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE],
|
cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE],
|
||||||
@ -54,7 +53,6 @@ class CreateAgentConfigMap(base.BaseTestCase):
|
|||||||
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
||||||
|
|
||||||
def test_create_agent_config_map_enable_tunneling(self):
|
def test_create_agent_config_map_enable_tunneling(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
# Verify setting only enable_tunneling will default tunnel_type to GRE
|
# Verify setting only enable_tunneling will default tunnel_type to GRE
|
||||||
cfg.CONF.set_override('tunnel_types', None, group='AGENT')
|
cfg.CONF.set_override('tunnel_types', None, group='AGENT')
|
||||||
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
|
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
|
||||||
@ -63,20 +61,17 @@ class CreateAgentConfigMap(base.BaseTestCase):
|
|||||||
self.assertEqual(cfgmap['tunnel_types'], [p_const.TYPE_GRE])
|
self.assertEqual(cfgmap['tunnel_types'], [p_const.TYPE_GRE])
|
||||||
|
|
||||||
def test_create_agent_config_map_fails_no_local_ip(self):
|
def test_create_agent_config_map_fails_no_local_ip(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
# An ip address is required for tunneling but there is no default
|
# An ip address is required for tunneling but there is no default
|
||||||
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
|
cfg.CONF.set_override('enable_tunneling', True, group='OVS')
|
||||||
with testtools.ExpectedException(ValueError):
|
with testtools.ExpectedException(ValueError):
|
||||||
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
||||||
|
|
||||||
def test_create_agent_config_map_fails_for_invalid_tunnel_type(self):
|
def test_create_agent_config_map_fails_for_invalid_tunnel_type(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('tunnel_types', ['foobar'], group='AGENT')
|
cfg.CONF.set_override('tunnel_types', ['foobar'], group='AGENT')
|
||||||
with testtools.ExpectedException(ValueError):
|
with testtools.ExpectedException(ValueError):
|
||||||
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
ovs_neutron_agent.create_agent_config_map(cfg.CONF)
|
||||||
|
|
||||||
def test_create_agent_config_map_multiple_tunnel_types(self):
|
def test_create_agent_config_map_multiple_tunnel_types(self):
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
|
cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
|
||||||
cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE,
|
cfg.CONF.set_override('tunnel_types', [p_const.TYPE_GRE,
|
||||||
p_const.TYPE_VXLAN], group='AGENT')
|
p_const.TYPE_VXLAN], group='AGENT')
|
||||||
@ -89,7 +84,6 @@ class TestOvsNeutronAgent(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestOvsNeutronAgent, self).setUp()
|
super(TestOvsNeutronAgent, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
notifier_p = mock.patch(NOTIFIER)
|
notifier_p = mock.patch(NOTIFIER)
|
||||||
notifier_cls = notifier_p.start()
|
notifier_cls = notifier_p.start()
|
||||||
self.notifier = mock.Mock()
|
self.notifier = mock.Mock()
|
||||||
@ -788,7 +782,6 @@ class AncillaryBridgesTest(base.BaseTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(AncillaryBridgesTest, self).setUp()
|
super(AncillaryBridgesTest, self).setUp()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
notifier_p = mock.patch(NOTIFIER)
|
notifier_p = mock.patch(NOTIFIER)
|
||||||
notifier_cls = notifier_p.start()
|
notifier_cls = notifier_p.start()
|
||||||
self.notifier = mock.Mock()
|
self.notifier = mock.Mock()
|
||||||
|
@ -25,10 +25,6 @@ from neutron.tests import base
|
|||||||
|
|
||||||
|
|
||||||
class TestLbaasService(base.BaseTestCase):
|
class TestLbaasService(base.BaseTestCase):
|
||||||
def setUp(self):
|
|
||||||
super(TestLbaasService, self).setUp()
|
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
def test_start(self):
|
def test_start(self):
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
agent.rpc_service.Service, 'start'
|
agent.rpc_service.Service, 'start'
|
||||||
|
@ -177,7 +177,6 @@ class AgentDBTestCase(AgentDBTestMixIn,
|
|||||||
self.saved_attr_map[resource] = attrs.copy()
|
self.saved_attr_map[resource] = attrs.copy()
|
||||||
ext_mgr = AgentTestExtensionManager()
|
ext_mgr = AgentTestExtensionManager()
|
||||||
self.addCleanup(self.restore_resource_attribute_map)
|
self.addCleanup(self.restore_resource_attribute_map)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
super(AgentDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
|
super(AgentDBTestCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
|
||||||
|
|
||||||
def restore_resource_attribute_map(self):
|
def restore_resource_attribute_map(self):
|
||||||
|
@ -16,16 +16,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron.agent import netns_cleanup_util as util
|
from neutron.agent import netns_cleanup_util as util
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
|
|
||||||
class TestNetnsCleanup(base.BaseTestCase):
|
class TestNetnsCleanup(base.BaseTestCase):
|
||||||
def setUp(self):
|
|
||||||
super(TestNetnsCleanup, self).setUp()
|
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
def test_kill_dhcp(self, dhcp_active=True):
|
def test_kill_dhcp(self, dhcp_active=True):
|
||||||
conf = mock.Mock()
|
conf = mock.Mock()
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import itertools
|
import itertools
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron.agent.linux import ip_lib
|
from neutron.agent.linux import ip_lib
|
||||||
from neutron.agent.linux import ovs_lib
|
from neutron.agent.linux import ovs_lib
|
||||||
@ -28,9 +27,6 @@ from neutron.tests import base
|
|||||||
|
|
||||||
|
|
||||||
class TestOVSCleanup(base.BaseTestCase):
|
class TestOVSCleanup(base.BaseTestCase):
|
||||||
def setUp(self):
|
|
||||||
super(TestOVSCleanup, self).setUp()
|
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
def test_setup_conf(self):
|
def test_setup_conf(self):
|
||||||
conf = util.setup_conf()
|
conf = util.setup_conf()
|
||||||
|
@ -114,7 +114,6 @@ class APIv2TestBase(base.BaseTestCase):
|
|||||||
instance._NeutronPluginBaseV2__native_pagination_support = True
|
instance._NeutronPluginBaseV2__native_pagination_support = True
|
||||||
instance._NeutronPluginBaseV2__native_sorting_support = True
|
instance._NeutronPluginBaseV2__native_sorting_support = True
|
||||||
self.addCleanup(self._plugin_patcher.stop)
|
self.addCleanup(self._plugin_patcher.stop)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
api = router.APIRouter()
|
api = router.APIRouter()
|
||||||
self.api = webtest.TestApp(api)
|
self.api = webtest.TestApp(api)
|
||||||
@ -1145,7 +1144,6 @@ class SubresourceTest(base.BaseTestCase):
|
|||||||
self._plugin_patcher = mock.patch(plugin, autospec=True)
|
self._plugin_patcher = mock.patch(plugin, autospec=True)
|
||||||
self.plugin = self._plugin_patcher.start()
|
self.plugin = self._plugin_patcher.start()
|
||||||
self.addCleanup(self._plugin_patcher.stop)
|
self.addCleanup(self._plugin_patcher.stop)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
router.SUB_RESOURCES['dummy'] = {
|
router.SUB_RESOURCES['dummy'] = {
|
||||||
'collection_name': 'dummies',
|
'collection_name': 'dummies',
|
||||||
@ -1439,7 +1437,6 @@ class ExtensionTestCase(base.BaseTestCase):
|
|||||||
self._plugin_patcher.stop()
|
self._plugin_patcher.stop()
|
||||||
self.api = None
|
self.api = None
|
||||||
self.plugin = None
|
self.plugin = None
|
||||||
cfg.CONF.reset()
|
|
||||||
# Restore the global RESOURCE_ATTRIBUTE_MAP
|
# Restore the global RESOURCE_ATTRIBUTE_MAP
|
||||||
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ class TestCli(base.BaseTestCase):
|
|||||||
self.do_alembic_cmd_p = mock.patch.object(cli, 'do_alembic_command')
|
self.do_alembic_cmd_p = mock.patch.object(cli, 'do_alembic_command')
|
||||||
self.do_alembic_cmd = self.do_alembic_cmd_p.start()
|
self.do_alembic_cmd = self.do_alembic_cmd_p.start()
|
||||||
self.addCleanup(self.do_alembic_cmd_p.stop)
|
self.addCleanup(self.do_alembic_cmd_p.stop)
|
||||||
self.addCleanup(cli.CONF.reset)
|
|
||||||
|
|
||||||
def _main_test_helper(self, argv, func_name, exp_args=(), exp_kwargs={}):
|
def _main_test_helper(self, argv, func_name, exp_args=(), exp_kwargs={}):
|
||||||
with mock.patch.object(sys, 'argv', argv):
|
with mock.patch.object(sys, 'argv', argv):
|
||||||
|
@ -161,7 +161,6 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
|
|||||||
# NOTE(jkoelker) for a 'pluggable' framework, Neutron sure
|
# NOTE(jkoelker) for a 'pluggable' framework, Neutron sure
|
||||||
# doesn't like when the plugin changes ;)
|
# doesn't like when the plugin changes ;)
|
||||||
db.clear_db()
|
db.clear_db()
|
||||||
cfg.CONF.reset()
|
|
||||||
# Restore the original attribute map
|
# Restore the original attribute map
|
||||||
attributes.RESOURCE_ATTRIBUTE_MAP = self._attribute_map_bk
|
attributes.RESOURCE_ATTRIBUTE_MAP = self._attribute_map_bk
|
||||||
super(NeutronDbPluginV2TestCase, self).tearDown()
|
super(NeutronDbPluginV2TestCase, self).tearDown()
|
||||||
|
@ -490,7 +490,6 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
|
|||||||
self.plugin_p.stop()
|
self.plugin_p.stop()
|
||||||
self.mock_makedirs_p.stop()
|
self.mock_makedirs_p.stop()
|
||||||
self.mock_init_p.stop()
|
self.mock_init_p.stop()
|
||||||
cfg.CONF.reset()
|
|
||||||
super(TestDhcpAgentEventHandler, self).tearDown()
|
super(TestDhcpAgentEventHandler, self).tearDown()
|
||||||
|
|
||||||
def _enable_dhcp_helper(self, isolated_metadata=False):
|
def _enable_dhcp_helper(self, isolated_metadata=False):
|
||||||
@ -1118,7 +1117,6 @@ class TestDeviceManager(base.BaseTestCase):
|
|||||||
self.dvr_cls_p.stop()
|
self.dvr_cls_p.stop()
|
||||||
self.device_exists_p.stop()
|
self.device_exists_p.stop()
|
||||||
self.iproute_cls_p.stop()
|
self.iproute_cls_p.stop()
|
||||||
cfg.CONF.reset()
|
|
||||||
super(TestDeviceManager, self).tearDown()
|
super(TestDeviceManager, self).tearDown()
|
||||||
|
|
||||||
def _test_setup_helper(self, device_exists, reuse_existing=False,
|
def _test_setup_helper(self, device_exists, reuse_existing=False,
|
||||||
|
@ -104,7 +104,6 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
|
|||||||
attributes.RESOURCE_ATTRIBUTE_MAP.update(
|
attributes.RESOURCE_ATTRIBUTE_MAP.update(
|
||||||
extattr.EXTENDED_ATTRIBUTES_2_0)
|
extattr.EXTENDED_ATTRIBUTES_2_0)
|
||||||
self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
|
self.agentscheduler_dbMinxin = manager.NeutronManager.get_plugin()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(self.restore_attribute_map)
|
self.addCleanup(self.restore_attribute_map)
|
||||||
|
|
||||||
quota.QUOTAS._driver = None
|
quota.QUOTAS._driver = None
|
||||||
|
@ -82,7 +82,6 @@ class ProvidernetExtensionTestCase(testlib_api.WebTestCase):
|
|||||||
ext_mgr = ProviderExtensionManager()
|
ext_mgr = ProviderExtensionManager()
|
||||||
self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
|
self.ext_mdw = test_extensions.setup_extensions_middleware(ext_mgr)
|
||||||
self.addCleanup(self._plugin_patcher.stop)
|
self.addCleanup(self._plugin_patcher.stop)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(self._restore_attribute_map)
|
self.addCleanup(self._restore_attribute_map)
|
||||||
self.api = webtest.TestApp(router.APIRouter())
|
self.api = webtest.TestApp(router.APIRouter())
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ class NeutronManagerTestCase(base.BaseTestCase):
|
|||||||
# If test_config specifies some config-file, use it, as well
|
# If test_config specifies some config-file, use it, as well
|
||||||
config.parse(args=args)
|
config.parse(args=args)
|
||||||
self.setup_coreplugin()
|
self.setup_coreplugin()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.useFixture(
|
self.useFixture(
|
||||||
fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance'))
|
fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance'))
|
||||||
|
|
||||||
|
@ -82,7 +82,6 @@ class QuotaExtensionTestCase(testlib_api.WebTestCase):
|
|||||||
self.api = None
|
self.api = None
|
||||||
self.plugin = None
|
self.plugin = None
|
||||||
db.clear_db()
|
db.clear_db()
|
||||||
cfg.CONF.reset()
|
|
||||||
|
|
||||||
# Restore the global RESOURCE_ATTRIBUTE_MAP
|
# Restore the global RESOURCE_ATTRIBUTE_MAP
|
||||||
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
attributes.RESOURCE_ATTRIBUTE_MAP = self.saved_attr_map
|
||||||
|
@ -170,7 +170,6 @@ class RouterServiceInsertionTestCase(base.BaseTestCase):
|
|||||||
self.setup_coreplugin(plugin)
|
self.setup_coreplugin(plugin)
|
||||||
cfg.CONF.set_override('service_plugins', [])
|
cfg.CONF.set_override('service_plugins', [])
|
||||||
cfg.CONF.set_override('quota_router', -1, group='QUOTAS')
|
cfg.CONF.set_override('quota_router', -1, group='QUOTAS')
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
# Ensure existing ExtensionManager is not used
|
# Ensure existing ExtensionManager is not used
|
||||||
|
|
||||||
@ -197,7 +196,6 @@ class RouterServiceInsertionTestCase(base.BaseTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.api = None
|
self.api = None
|
||||||
db.clear_db()
|
db.clear_db()
|
||||||
cfg.CONF.reset()
|
|
||||||
super(RouterServiceInsertionTestCase, self).tearDown()
|
super(RouterServiceInsertionTestCase, self).tearDown()
|
||||||
|
|
||||||
def _setup_core_resources(self):
|
def _setup_core_resources(self):
|
||||||
|
@ -179,7 +179,6 @@ class ServiceTypeExtensionTestCaseBase(testlib_api.WebTestCase):
|
|||||||
cfg.CONF.set_override('service_plugins',
|
cfg.CONF.set_override('service_plugins',
|
||||||
["%s.%s" % (dp.__name__,
|
["%s.%s" % (dp.__name__,
|
||||||
dp.DummyServicePlugin.__name__)])
|
dp.DummyServicePlugin.__name__)])
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
# Ensure existing ExtensionManager is not used
|
# Ensure existing ExtensionManager is not used
|
||||||
extensions.PluginAwareExtensionManager._instance = None
|
extensions.PluginAwareExtensionManager._instance = None
|
||||||
ext_mgr = TestServiceTypeExtensionManager()
|
ext_mgr = TestServiceTypeExtensionManager()
|
||||||
|
@ -77,7 +77,6 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
|||||||
cfg.CONF.set_override('metadata_mode', None, 'NSX')
|
cfg.CONF.set_override('metadata_mode', None, 'NSX')
|
||||||
self.addCleanup(self.fc.reset_all)
|
self.addCleanup(self.fc.reset_all)
|
||||||
self.addCleanup(self.restore_resource_attribute_map)
|
self.addCleanup(self.restore_resource_attribute_map)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
super(MacLearningDBTestCase, self).setUp(plugin=PLUGIN_NAME,
|
super(MacLearningDBTestCase, self).setUp(plugin=PLUGIN_NAME,
|
||||||
ext_mgr=ext_mgr)
|
ext_mgr=ext_mgr)
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ class NetworkGatewayExtensionTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
# Update the plugin and extensions path
|
# Update the plugin and extensions path
|
||||||
self.setup_coreplugin(plugin)
|
self.setup_coreplugin(plugin)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
_plugin_patcher = mock.patch(plugin, autospec=True)
|
_plugin_patcher = mock.patch(plugin, autospec=True)
|
||||||
self.plugin = _plugin_patcher.start()
|
self.plugin = _plugin_patcher.start()
|
||||||
|
@ -49,7 +49,6 @@ class DhcpAgentNotifierTestCase(test_base.OvsDhcpAgentNotifierTestCase):
|
|||||||
self.addCleanup(self.fc.reset_all)
|
self.addCleanup(self.fc.reset_all)
|
||||||
self.addCleanup(patch_sync.stop)
|
self.addCleanup(patch_sync.stop)
|
||||||
self.addCleanup(self.mock_nsx_api.stop)
|
self.addCleanup(self.mock_nsx_api.stop)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
|
|
||||||
def _test_gateway_subnet_notification(self, gateway='10.0.0.1'):
|
def _test_gateway_subnet_notification(self, gateway='10.0.0.1'):
|
||||||
cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NSX')
|
cfg.CONF.set_override('metadata_mode', 'dhcp_host_route', 'NSX')
|
||||||
|
@ -268,7 +268,6 @@ class LsnManagerTestCase(base.BaseTestCase):
|
|||||||
self.mock_lsn_api = self.mock_lsn_api_p.start()
|
self.mock_lsn_api = self.mock_lsn_api_p.start()
|
||||||
nsx.register_dhcp_opts(cfg)
|
nsx.register_dhcp_opts(cfg)
|
||||||
nsx.register_metadata_opts(cfg)
|
nsx.register_metadata_opts(cfg)
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(self.mock_lsn_api_p.stop)
|
self.addCleanup(self.mock_lsn_api_p.stop)
|
||||||
|
|
||||||
def test_lsn_get(self):
|
def test_lsn_get(self):
|
||||||
@ -703,7 +702,6 @@ class PersistentLsnManagerTestCase(base.BaseTestCase):
|
|||||||
self.context = context.get_admin_context()
|
self.context = context.get_admin_context()
|
||||||
self.mock_lsn_api_p = mock.patch.object(lsn_man, 'lsn_api')
|
self.mock_lsn_api_p = mock.patch.object(lsn_man, 'lsn_api')
|
||||||
self.mock_lsn_api = self.mock_lsn_api_p.start()
|
self.mock_lsn_api = self.mock_lsn_api_p.start()
|
||||||
self.addCleanup(cfg.CONF.reset)
|
|
||||||
self.addCleanup(self.mock_lsn_api_p.stop)
|
self.addCleanup(self.mock_lsn_api_p.stop)
|
||||||
self.addCleanup(db.clear_db)
|
self.addCleanup(db.clear_db)
|
||||||
|
|
||||||
|
@ -302,10 +302,6 @@ class SyncTestCase(base.BaseTestCase):
|
|||||||
self.addCleanup(mock_nm_get_plugin.stop)
|
self.addCleanup(mock_nm_get_plugin.stop)
|
||||||
self.addCleanup(mock_nm_get_service_plugins.stop)
|
self.addCleanup(mock_nm_get_service_plugins.stop)
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
cfg.CONF.reset()
|
|
||||||
super(SyncTestCase, self).tearDown()
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _populate_data(self, ctx, net_size=2, port_size=2, router_size=2):
|
def _populate_data(self, ctx, net_size=2, port_size=2, router_size=2):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user