tests/unit: refactor reading neutron.conf.test

neutron.conf.test includes rpc_backend whose value is stashed.
Thus it is required to reset when tearing down, otherwise the stale status
will be used by succeeding tests causing random error.

This patch refactors reading neutron.conf.test and resets the status of
rpc_backend properly.

Closes-Bug: #1281481
Closes-Bug: #1284549
Change-Id: I0fa5945b6adbb9945d353028ec88d00ccbf4e31a
This commit is contained in:
Isaku Yamahata 2014-02-26 11:36:56 +09:00
parent 930e18e35a
commit a98dc7680d
23 changed files with 68 additions and 137 deletions

View File

@ -20,6 +20,7 @@
import contextlib
import logging
import os
import os.path
import sys
import eventlet.timeout
@ -28,10 +29,13 @@ import mock
from oslo.config import cfg
import testtools
from neutron.common import config
from neutron.common import constants as const
from neutron import manager
from neutron.openstack.common.notifier import api as notifier_api
from neutron.openstack.common.notifier import test_notifier
from neutron.openstack.common import rpc
from neutron.openstack.common.rpc import impl_fake
from neutron.tests import post_mortem_debug
@ -40,6 +44,13 @@ CONF.import_opt('state_path', 'neutron.common.config')
TRUE_STRING = ['True', '1']
LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s"
ROOTDIR = os.path.dirname(__file__)
ETCDIR = os.path.join(ROOTDIR, 'etc')
def etcdir(*p):
return os.path.join(ETCDIR, *p)
def fake_use_fatal_exceptions(*args):
return True
@ -75,8 +86,24 @@ class BaseTestCase(testtools.TestCase):
notification_driver = [test_notifier.__name__]
cfg.CONF.set_override("notification_driver", notification_driver)
@staticmethod
def config_parse(conf=None, args=None):
"""Create the default configurations."""
# neutron.conf.test includes rpc_backend which needs to be cleaned up
if args is None:
args = ['--config-file', etcdir('neutron.conf.test')]
if conf is None:
config.parse(args=args)
else:
conf(args)
def _cleanup_rpc_backend(self):
rpc._RPCIMPL = None
impl_fake.CONSUMERS.clear()
def setUp(self):
super(BaseTestCase, self).setUp()
self.addCleanup(self._cleanup_rpc_backend)
# Configure this first to ensure pm debugging support for setUp()
if os.environ.get('OS_POST_MORTEM_DEBUG') in TRUE_STRING:

View File

@ -16,18 +16,15 @@
import mock
from oslo.config import cfg
from neutron.common import config as neutron_config
from neutron.plugins.cisco.common import config as cisco_config
from neutron.tests import base
from neutron.tests.unit import test_api_v2
class TestCiscoNexusPluginConfig(base.BaseTestCase):
def setUp(self):
# Point neutron config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
neutron_config.parse(args=args)
self.config_parse()
super(TestCiscoNexusPluginConfig, self).setUp()

View File

@ -17,22 +17,19 @@ import sys
import mock
from neutron.common import config
from neutron import context
from neutron.plugins.cisco.common import cisco_constants as const
from neutron.plugins.cisco.common import config as cisco_config
from neutron.plugins.cisco.models import virt_phy_sw_v2
from neutron.plugins.cisco.nexus import cisco_nexus_plugin_v2
from neutron.tests import base
from neutron.tests.unit import test_api_v2
class TestCiscoPluginModel(base.BaseTestCase):
def setUp(self):
# Point config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
super(TestCiscoPluginModel, self).setUp()

View File

@ -15,7 +15,6 @@
import contextlib
import logging
import os
import mock
from oslo.config import cfg
@ -51,18 +50,12 @@ DB_LB_PLUGIN_KLASS = (
)
NOOP_DRIVER_KLASS = ('neutron.tests.unit.db.loadbalancer.test_db_loadbalancer.'
'NoopLbaaSDriver')
ROOTDIR = os.path.dirname(__file__) + '../../../..'
ETCDIR = os.path.join(ROOTDIR, 'etc')
extensions_path = ':'.join(neutron.extensions.__path__)
_subnet_id = "0c798ed8-33ba-11e2-8b28-000c291c4d14"
def etcdir(*p):
return os.path.join(ETCDIR, *p)
class NoopLbaaSDriver(abstract_driver.LoadBalancerAbstractDriver):
"""A dummy lbass driver that that only performs object deletion."""

View File

@ -15,8 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import mock
from oslo.config import cfg
import testtools
@ -36,8 +34,6 @@ from neutron.plugins.metaplugin.meta_neutron_plugin import MetaPluginV2
from neutron.tests import base
CONF_FILE = ""
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
META_PATH = "neutron.plugins.metaplugin"
FAKE_PATH = "neutron.tests.unit.metaplugin"
PROXY_PATH = "%s.proxy_neutron_plugin.ProxyPluginV2" % META_PATH
@ -49,10 +45,6 @@ fake1:%s.fake_plugin.Fake1,fake2:%s.fake_plugin.Fake2
""".strip() % (FAKE_PATH, FAKE_PATH)
def etcdir(*p):
return os.path.join(ETCDIR, *p)
def setup_metaplugin_conf(has_l3=True):
cfg.CONF.set_override('auth_url', 'http://localhost:35357/v2.0',
'PROXY')

View File

@ -17,18 +17,14 @@
import mock
from oslo.config import cfg
from neutron.common import config as neutron_config
from neutron.plugins.ml2.drivers.cisco.nexus import config as cisco_config
from neutron.tests import base
from neutron.tests.unit import test_api_v2
class TestCiscoNexusPluginConfig(base.BaseTestCase):
def setUp(self):
# Point neutron config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
neutron_config.parse(args=args)
self.config_parse()
super(TestCiscoNexusPluginConfig, self).setUp()
def test_config_parse_error(self):

View File

@ -30,7 +30,6 @@ from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.api.v2 import attributes
from neutron.api.v2 import base as v2_base
from neutron.api.v2 import router
from neutron.common import config
from neutron.common import exceptions as n_exc
from neutron import context
from neutron.manager import NeutronManager
@ -44,16 +43,11 @@ from neutron.tests.unit import testlib_api
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
EXTDIR = os.path.join(ROOTDIR, 'unit/extensions')
_uuid = uuidutils.generate_uuid
def etcdir(*p):
return os.path.join(ETCDIR, *p)
def _get_path(resource, id=None, action=None, fmt=None):
path = '/%s' % resource
@ -102,8 +96,7 @@ class APIv2TestBase(base.BaseTestCase):
# Ensure existing ExtensionManager is not used
PluginAwareExtensionManager._instance = None
# Create the default configurations
args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
# Update the plugin
self.setup_coreplugin(plugin)
cfg.CONF.set_override('allow_pagination', True)
@ -1136,8 +1129,7 @@ class SubresourceTest(base.BaseTestCase):
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
self.saved_attr_map[resource] = attrs.copy()
args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
self.setup_coreplugin(plugin)
self._plugin_patcher = mock.patch(plugin, autospec=True)
@ -1410,8 +1402,7 @@ class ExtensionTestCase(base.BaseTestCase):
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
args = ['--config-file', etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(plugin)

View File

@ -27,7 +27,6 @@ import webtest
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.common import config
from neutron import quota
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_extensions
@ -60,8 +59,7 @@ class ExtensionTestCase(testlib_api.WebTestCase):
self.addCleanup(self._resotre_attr_map)
# Create the default configurations
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args)
self.config_parse()
#just stubbing core plugin with plugin
self.setup_coreplugin(plugin)

View File

@ -17,7 +17,6 @@
import contextlib
import copy
import os
import mock
from oslo.config import cfg
@ -30,7 +29,6 @@ from neutron.api.extensions import PluginAwareExtensionManager
from neutron.api.v2 import attributes
from neutron.api.v2.attributes import ATTR_NOT_SPECIFIED
from neutron.api.v2.router import APIRouter
from neutron.common import config
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common.test_lib import test_config
@ -45,8 +43,6 @@ from neutron.tests.unit import test_extensions
from neutron.tests.unit import testlib_api
DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
def optional_ctx(obj, fallback):
@ -59,10 +55,6 @@ def optional_ctx(obj, fallback):
return context_wrapper()
def etcdir(*p):
return os.path.join(ETCDIR, *p)
def _fake_get_pagination_helper(self, request):
return api_common.PaginationEmulatedHelper(request, self._primary_key)
@ -98,11 +90,11 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
plugin = DB_PLUGIN_KLASS
# Create the default configurations
args = ['--config-file', etcdir('neutron.conf.test')]
args = ['--config-file', base.etcdir('neutron.conf.test')]
# If test_config specifies some config-file, use it, as well
for config_file in test_config.get('config_files', []):
args.extend(['--config-file', config_file])
config.parse(args=args)
self.config_parse(args=args)
# Update the plugin
self.setup_coreplugin(plugin)
cfg.CONF.set_override(

View File

@ -16,7 +16,6 @@
# under the License.
import copy
import os
import sys
import uuid
@ -36,8 +35,6 @@ from neutron.openstack.common.rpc import common
from neutron.tests import base
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
HOSTNAME = 'hostname'
dev_man = dhcp.DeviceManager
rpc_api = dhcp_agent.DhcpPluginApi
@ -45,10 +42,6 @@ DEVICE_MANAGER = '%s.%s' % (dev_man.__module__, dev_man.__name__)
DHCP_PLUGIN = '%s.%s' % (rpc_api.__module__, rpc_api.__name__)
def etcdir(*p):
return os.path.join(ETCDIR, *p)
fake_tenant_id = 'aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'
fake_subnet1_allocation_pools = dhcp.DictModel(dict(id='', start='172.9.9.2',
end='172.9.9.254'))
@ -158,7 +151,7 @@ class TestDhcpAgent(base.BaseTestCase):
with mock.patch.object(sys, 'argv') as sys_argv:
sys_argv.return_value = [
'dhcp', '--config-file',
etcdir('neutron.conf.test')]
base.etcdir('neutron.conf.test')]
cfg.CONF.register_opts(dhcp_agent.DhcpAgent.OPTS)
config.register_interface_driver_opts_helper(cfg.CONF)
config.register_agent_state_opts_helper(cfg.CONF)
@ -183,7 +176,7 @@ class TestDhcpAgent(base.BaseTestCase):
with mock.patch.object(sys, 'argv') as sys_argv:
with mock.patch(launcher_str) as launcher:
sys_argv.return_value = ['dhcp', '--config-file',
etcdir('neutron.conf.test')]
base.etcdir('neutron.conf.test')]
dhcp_agent.main()
launcher.assert_has_calls(
[mock.call(), mock.call().launch_service(mock.ANY),

View File

@ -77,8 +77,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
)
# point config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
self.setup_coreplugin(plugin)

View File

@ -14,7 +14,6 @@
# limitations under the License.
import contextlib
import os
import mock
import webob.exc
@ -31,12 +30,6 @@ from neutron.tests.unit import test_db_plugin
DB_PLUGIN_KLASS = ('neutron.tests.unit.test_extension_security_group.'
'SecurityGroupTestPlugin')
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
def etcdir(*p):
return os.path.join(ETCDIR, *p)
class SecurityGroupTestExtensionManager(object):

View File

@ -15,8 +15,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import mock
import routes
import webob
@ -37,14 +35,6 @@ from neutron import wsgi
LOG = logging.getLogger(__name__)
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
def etcdir(*p):
return os.path.join(ETCDIR, *p)
extensions_path = ':'.join(neutron.tests.unit.extensions.__path__)
@ -404,7 +394,7 @@ class RequestExtensionTest(base.BaseTestCase):
res.body = jsonutils.dumps(data)
return res
base_app = webtest.TestApp(setup_base_app())
base_app = webtest.TestApp(setup_base_app(self))
response = base_app.put("/dummy_resources/1",
{'uneditable': "new_value"})
self.assertEqual(response.json['uneditable'], "original_value")
@ -606,10 +596,8 @@ def app_factory(global_conf, **local_conf):
return ExtensionsTestApp(conf)
def setup_base_app():
config_file = 'neutron.conf.test'
args = ['--config-file', etcdir(config_file)]
config.parse(args=args)
def setup_base_app(test):
base.BaseTestCase.config_parse()
app = config.load_paste_app('extensions_test_app')
return app
@ -619,9 +607,7 @@ def setup_extensions_middleware(extension_manager=None):
extensions.PluginAwareExtensionManager(
extensions_path,
{constants.CORE: FakePluginWithExtension()}))
config_file = 'neutron.conf.test'
args = ['--config-file', etcdir(config_file)]
config.parse(args=args)
base.BaseTestCase.config_parse()
app = config.load_paste_app('extensions_test_app')
return extensions.ExtensionMiddleware(app, ext_mgr=extension_manager)

View File

@ -390,9 +390,6 @@ class LocalChild(dhcp.DhcpLocalProcess):
class TestBase(base.BaseTestCase):
def setUp(self):
super(TestBase, self).setUp()
root = os.path.dirname(os.path.dirname(__file__))
args = ['--config-file',
os.path.join(root, 'etc', 'neutron.conf.test')]
self.conf = config.setup_conf()
self.conf.register_opts(base_config.core_opts)
self.conf.register_opts(dhcp.OPTS)
@ -401,7 +398,7 @@ class TestBase(base.BaseTestCase):
self.mock_mgr = instance.start()
self.conf.register_opt(cfg.BoolOpt('enable_isolated_metadata',
default=True))
self.conf(args=args)
self.config_parse(self.conf)
self.conf.set_override('state_path', '')
self.conf.use_namespaces = True

View File

@ -15,14 +15,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import types
import fixtures
from oslo.config import cfg
from neutron.common import config
from neutron.manager import NeutronManager
from neutron.manager import validate_post_plugin_load
from neutron.manager import validate_pre_plugin_load
@ -34,12 +32,6 @@ from neutron.tests.unit import dummy_plugin
LOG = logging.getLogger(__name__)
DB_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc')
def etcdir(*p):
return os.path.join(ETCDIR, *p)
class MultiServiceCorePlugin(object):
@ -55,9 +47,7 @@ class NeutronManagerTestCase(base.BaseTestCase):
def setUp(self):
super(NeutronManagerTestCase, self).setUp()
args = ['--config-file', etcdir('neutron.conf.test')]
# If test_config specifies some config-file, use it, as well
config.parse(args=args)
self.config_parse()
self.setup_coreplugin()
self.useFixture(
fixtures.MonkeyPatch('neutron.manager.NeutronManager._instance'))

View File

@ -32,7 +32,6 @@ from neutron.db import quota_db
from neutron import quota
from neutron.tests import base
from neutron.tests.unit import test_api_v2
from neutron.tests.unit import test_extensions
from neutron.tests.unit import testlib_api
TARGET_PLUGIN = ('neutron.plugins.linuxbridge.lb_neutron_plugin'
@ -54,8 +53,7 @@ class QuotaExtensionTestCase(testlib_api.WebTestCase):
self.saved_attr_map[resource] = attrs.copy()
# Create the default configurations
args = ['--config-file', test_extensions.etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(TARGET_PLUGIN)

View File

@ -163,8 +163,7 @@ class RouterServiceInsertionTestCase(base.BaseTestCase):
)
# point config file to: neutron/tests/etc/neutron.conf.test
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
#just stubbing core plugin with LoadBalancer plugin
self.setup_coreplugin(plugin)

View File

@ -22,7 +22,6 @@ import webtest
from neutron.api import extensions
from neutron.api.extensions import PluginAwareExtensionManager
from neutron.api.v2 import attributes
from neutron.common import config
from neutron import context
from neutron.db import api as db_api
from neutron.db import db_base_plugin_v2
@ -77,8 +76,7 @@ class NetworkGatewayExtensionTestCase(base.BaseTestCase):
extensions.PluginAwareExtensionManager._instance = None
# Create the default configurations
args = ['--config-file', test_api_v2.etcdir('neutron.conf.test')]
config.parse(args=args)
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(plugin)

View File

@ -18,7 +18,6 @@ import fixtures
import mock
from oslo.config import cfg
from neutron.common import config as q_config
from neutron.manager import NeutronManager
from neutron.openstack.common import uuidutils
from neutron.plugins.vmware.api_client import client
@ -99,7 +98,7 @@ class ConfigurationTest(base.BaseTestCase):
self.assertEqual('whatever', cluster.default_interface_name)
def test_load_plugin_with_full_options(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
plugin = NeutronManager().get_plugin()
@ -108,7 +107,7 @@ class ConfigurationTest(base.BaseTestCase):
self._assert_extra_options(cluster)
def test_load_plugin_with_required_options_only(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
plugin = NeutronManager().get_plugin()
@ -135,7 +134,7 @@ class ConfigurationTest(base.BaseTestCase):
self.assertEqual('breth0', cfg.CONF.default_interface_name)
def test_load_api_extensions(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
# Load the configuration, and initialize the plugin
@ -143,7 +142,7 @@ class ConfigurationTest(base.BaseTestCase):
self.assertIn('extensions', cfg.CONF.api_extensions_path)
def test_agentless_extensions(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_AGENTLESS_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
self.assertEqual(config.AgentModes.AGENTLESS,
@ -162,7 +161,7 @@ class ConfigurationTest(base.BaseTestCase):
plugin.supported_extension_aliases)
def test_agentless_extensions_version_fail(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_AGENTLESS_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
self.assertEqual(config.AgentModes.AGENTLESS,
@ -173,7 +172,7 @@ class ConfigurationTest(base.BaseTestCase):
self.assertRaises(exceptions.NsxPluginException, NeutronManager)
def test_agentless_extensions_unmet_deps_fail(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_AGENTLESS_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
self.assertEqual(config.AgentModes.AGENTLESS,
@ -188,7 +187,7 @@ class ConfigurationTest(base.BaseTestCase):
NeutronManager)
def test_agent_extensions(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NSX_INI_FULL_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
self.assertEqual(config.AgentModes.AGENT,
@ -218,7 +217,7 @@ class OldNVPConfigurationTest(base.BaseTestCase):
self.assertEqual(cluster.default_tz_uuid, 'fake_tz_uuid')
def test_load_plugin_with_deprecated_options(self):
q_config.parse(['--config-file', BASE_CONF_PATH,
self.config_parse(args=['--config-file', BASE_CONF_PATH,
'--config-file', NVP_INI_DEPR_PATH])
cfg.CONF.set_override('core_plugin', PLUGIN_NAME)
plugin = NeutronManager().get_plugin()

View File

@ -21,7 +21,6 @@ import mock
from oslo.config import cfg
from neutron.api.v2 import attributes as attr
from neutron.common import config
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron import context
@ -287,7 +286,7 @@ class SyncTestCase(base.BaseTestCase):
# and setup needed config variables
args = ['--config-file', get_fake_conf('neutron.conf.test'),
'--config-file', get_fake_conf('nsx.ini.test')]
config.parse(args=args)
self.config_parse(args=args)
cfg.CONF.set_override('allow_overlapping_ips', True)
self._plugin = plugin.NsxPlugin()
# Mock neutron manager plugin load functions to speed up tests

View File

@ -17,7 +17,6 @@ import contextlib
import mock
import webob.exc
from neutron.common import config as n_config
from neutron import context
from neutron.db.firewall import firewall_db
from neutron.openstack.common import uuidutils
@ -61,7 +60,7 @@ class VcnsDriverTestCase(test_db_firewall.FirewallPluginDbTestCase,
def setUp(self):
n_config.parse(['--config-file', VCNS_CONFIG_FILE])
self.config_parse(args=['--config-file', VCNS_CONFIG_FILE])
# mock vcns
self.fc2 = fake_vcns.FakeVcns(unique_router_name=False)
self.mock_vcns = mock.patch(VCNS_NAME, autospec=True)

View File

@ -16,7 +16,6 @@
import mock
from neutron.common import config as n_config
from neutron import context
from neutron.openstack.common import uuidutils
from neutron.plugins.vmware.dbexts import vcns_db
@ -78,7 +77,7 @@ class VcnsDriverTestCase(test_db_loadbalancer.LoadBalancerPluginDbTestCase):
def setUp(self):
n_config.parse(['--config-file', VCNS_CONFIG_FILE])
self.config_parse(args=['--config-file', VCNS_CONFIG_FILE])
# mock vcns
self.fc2 = fake_vcns.FakeVcns(unique_router_name=False)
self.mock_vcns = mock.patch(VCNS_NAME, autospec=True)

View File

@ -16,7 +16,6 @@
from eventlet import greenthread
import mock
from neutron.common import config as n_config
from neutron.plugins.vmware.vshield.common import constants as vcns_const
from neutron.plugins.vmware.vshield.common.constants import RouterStatus
from neutron.plugins.vmware.vshield.tasks.constants import TaskState
@ -315,7 +314,7 @@ class VcnsDriverTestCase(base.BaseTestCase):
def setUp(self):
super(VcnsDriverTestCase, self).setUp()
n_config.parse(['--config-file', VCNS_CONFIG_FILE])
self.config_parse(args=['--config-file', VCNS_CONFIG_FILE])
self.fc = fake_vcns.FakeVcns()
self.mock_vcns = mock.patch(VCNS_NAME, autospec=True)