Fix failures caused by upstream changes

Change-Id: I7bb871e7cfd1b49b7a2532d2d5a151feb111b2f5
This commit is contained in:
Amey Bhide 2015-06-26 12:20:54 -07:00
parent 97ac25f785
commit b42f0cedc6
6 changed files with 59 additions and 21 deletions

View File

@ -15,7 +15,6 @@
import mock
from neutron.api.v2 import attributes
from neutron.common import test_lib
from neutron import context
from neutron.extensions import agent
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin
@ -26,6 +25,7 @@ from vmware_nsx.neutron.plugins.vmware.api_client import version
from vmware_nsx.neutron.plugins.vmware.common import sync
from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.neutron.tests.unit.vmware.apiclient import fake
from vmware_nsx.neutron.tests.unit.vmware import test_utils
class MacLearningExtensionManager(object):
@ -50,8 +50,7 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
fmt = 'json'
def setUp(self):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.full.test')]
test_utils.override_nsx_ini_full_test()
cfg.CONF.set_override('api_extensions_path', vmware.NSXEXT_PATH)
# Save the original RESOURCE_ATTRIBUTE_MAP
self.saved_attr_map = {}

View File

@ -15,18 +15,17 @@
import mock
from neutron.common import test_lib
from neutron.tests.unit.extensions import test_portsecurity as psec
from vmware_nsx.neutron.plugins.vmware.common import sync
from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.neutron.tests.unit.vmware.apiclient import fake
from vmware_nsx.neutron.tests.unit.vmware import test_utils
class PortSecurityTestCase(psec.PortSecurityDBTestCase):
def setUp(self):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.test')]
test_utils.override_nsx_ini_test()
# mock api client
self.fc = fake.FakeClient(vmware.STUBS_PATH)
self.mock_nsx = mock.patch(vmware.NSXAPI_NAME, autospec=True)

View File

@ -17,12 +17,13 @@ import mock
from oslo_config import cfg
from neutron.common import constants
from neutron.common import test_lib
from neutron.tests.unit.plugins.openvswitch import test_agent_scheduler
from neutron.tests.unit.plugins.ml2.drivers.openvswitch.agent import (
test_agent_scheduler) # noqa
from vmware_nsx.neutron.plugins.vmware.common import sync
from vmware_nsx.neutron.plugins.vmware.dhcp_meta import rpc
from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.neutron.tests.unit.vmware.apiclient import fake
from vmware_nsx.neutron.tests.unit.vmware import test_utils
class DhcpAgentNotifierTestCase(
@ -30,9 +31,7 @@ class DhcpAgentNotifierTestCase(
plugin_str = vmware.PLUGIN_NAME
def setUp(self):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.full.test')]
test_utils.override_nsx_ini_full_test()
# mock api client
self.fc = fake.FakeClient(vmware.STUBS_PATH)
self.mock_nsx_api = mock.patch(vmware.NSXAPI_NAME, autospec=True)

View File

@ -20,7 +20,6 @@ import netaddr
from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as ntn_exc
import neutron.common.test_lib as test_lib
from neutron import context
from neutron.extensions import dvr
from neutron.extensions import external_net
@ -53,6 +52,7 @@ from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db
from vmware_nsx.neutron.plugins.vmware import nsxlib
from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.neutron.tests.unit.vmware.apiclient import fake
from vmware_nsx.neutron.tests.unit.vmware import test_utils
LOG = log.getLogger(__name__)
@ -90,8 +90,7 @@ class NsxPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
plugin=vmware.PLUGIN_NAME,
ext_mgr=None,
service_plugins=None):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.test')]
test_utils.override_nsx_ini_test()
# mock api client
self.fc = fake.FakeClient(vmware.STUBS_PATH)
self.mock_nsx = mock.patch(vmware.NSXAPI_NAME, autospec=True)
@ -360,8 +359,7 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxPluginV2TestCase):
class SecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
def setUp(self):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.test')]
test_utils.override_nsx_ini_test()
# mock nsx api client
self.fc = fake.FakeClient(vmware.STUBS_PATH)
self.mock_nsx = mock.patch(vmware.NSXAPI_NAME, autospec=True)

View File

@ -20,7 +20,6 @@ from neutron.api.v2 import attributes
from neutron.common import constants
from neutron.common import exceptions as n_exc
from neutron.common import ipv6_utils
import neutron.common.test_lib as test_lib
from neutron import context
from neutron.extensions import dvr as dist_router
from neutron.extensions import external_net
@ -55,6 +54,7 @@ from vmware_nsx.neutron.plugins.vmware.vshield.common import (
from vmware_nsx.neutron.plugins.vmware.vshield import edge_utils
from vmware_nsx.neutron.tests.unit import vmware
from vmware_nsx.neutron.tests.unit.vmware.extensions import test_vnic_index
from vmware_nsx.neutron.tests.unit.vmware import test_utils
from vmware_nsx.neutron.tests.unit.vmware.vshield import fake_vcns
PLUGIN_NAME = 'vmware_nsx.neutron.plugins.vmware.plugin.NsxVPlugin'
@ -95,8 +95,7 @@ class NsxVPluginV2TestCase(test_plugin.NeutronDbPluginV2TestCase):
plugin=PLUGIN_NAME,
ext_mgr=None,
service_plugins=None):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.test')]
test_utils.override_nsx_ini_test()
mock_vcns = mock.patch(vmware.VCNS_NAME, autospec=True)
mock_vcns_instance = mock_vcns.start()
self.fc2 = fake_vcns.FakeVcns()
@ -1761,8 +1760,7 @@ class NsxVSecurityGroupsTestCase(ext_sg.SecurityGroupDBTestCase):
plugin=PLUGIN_NAME,
ext_mgr=None,
service_plugins=None):
test_lib.test_config['config_files'] = [
vmware.get_fake_conf('nsx.ini.test')]
test_utils.override_nsx_ini_test()
mock_vcns = mock.patch(vmware.VCNS_NAME, autospec=True)
mock_vcns_instance = mock_vcns.start()
self.fc2 = fake_vcns.FakeVcns()

View File

@ -0,0 +1,45 @@
# Copyright (c) 2012 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_config import cfg
def override_nsx_ini_test():
cfg.CONF.set_override("default_tz_uuid", "fake_tz_uuid")
cfg.CONF.set_override("nsx_controllers", ["fake1", "fake_2"])
cfg.CONF.set_override("nsx_user", "foo")
cfg.CONF.set_override("nsx_password", "bar")
cfg.CONF.set_override("default_l3_gw_service_uuid", "whatever")
cfg.CONF.set_override("default_l2_gw_service_uuid", "whatever")
cfg.CONF.set_override("manager_uri", "https://fake_manager",
group="nsxv")
cfg.CONF.set_override("user", "fake_user", group="nsxv")
cfg.CONF.set_override("password", "fake_password", group="nsxv")
cfg.CONF.set_override("vdn_scope_id", "fake_vdn_scope_id",
group="nsxv")
cfg.CONF.set_override("dvs_id", "fake_dvs_id", group="nsxv")
def override_nsx_ini_full_test():
cfg.CONF.set_override("default_tz_uuid", "fake_tz_uuid")
cfg.CONF.set_override("nsx_controllers", ["fake1", "fake_2"])
cfg.CONF.set_override("nsx_user", "foo")
cfg.CONF.set_override("nsx_password", "bar")
cfg.CONF.set_override("default_l3_gw_service_uuid", "whatever")
cfg.CONF.set_override("default_l2_gw_service_uuid", "whatever")
cfg.CONF.set_override("default_interface_name", "whatever")
cfg.CONF.set_override("http_timeout", 13)
cfg.CONF.set_override("redirects", 12)
cfg.CONF.set_override("retries", "11")