Fixing the tests to run again
Also some minor pep8 and pylint fixes. Change-Id: I22348710a7829197b539830f6acdc92b619bdc0c
This commit is contained in:
parent
12a3a2b2da
commit
3028ab0326
@ -19,9 +19,6 @@ from oslo.db.sqlalchemy import session
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy import event
|
from sqlalchemy import event
|
||||||
|
|
||||||
from neutron.db.migration.models import head # noqa
|
|
||||||
from neutron.db.migration.cli import * # noqa
|
|
||||||
|
|
||||||
|
|
||||||
MYSQL_ENGINE = None
|
MYSQL_ENGINE = None
|
||||||
LBAAS_VERSION_TABLE = 'alembic_version_lbaas'
|
LBAAS_VERSION_TABLE = 'alembic_version_lbaas'
|
||||||
@ -85,4 +82,4 @@ def run_migrations_online():
|
|||||||
if context.is_offline_mode():
|
if context.is_offline_mode():
|
||||||
run_migrations_offline()
|
run_migrations_offline()
|
||||||
else:
|
else:
|
||||||
run_migrations_online()
|
run_migrations_online()
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
# Copyright 2011 OpenStack Foundation.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
cfg.CONF.use_stderr = False
|
|
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (c) 2014 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.
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
import neutron
|
||||||
|
from oslo.config import cfg
|
||||||
|
|
||||||
|
|
||||||
|
def override_nvalues():
|
||||||
|
neutron_path = os.path.abspath(
|
||||||
|
os.path.join(os.path.dirname(neutron.__file__), os.pardir))
|
||||||
|
neutron_policy = os.path.join(neutron_path, 'etc/policy.json')
|
||||||
|
cfg.CONF.set_override('policy_file', neutron_policy)
|
@ -16,10 +16,7 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
import neutron
|
||||||
import testtools
|
|
||||||
import webob.exc
|
|
||||||
|
|
||||||
from neutron.api import extensions
|
from neutron.api import extensions
|
||||||
from neutron.common import config
|
from neutron.common import config
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
@ -31,20 +28,25 @@ from neutron import manager
|
|||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.services import provider_configuration as pconf
|
from neutron.services import provider_configuration as pconf
|
||||||
from neutron.tests.unit import test_db_plugin
|
from neutron.tests.unit import test_db_plugin
|
||||||
|
from oslo.config import cfg
|
||||||
|
import testtools
|
||||||
|
import webob.exc
|
||||||
|
|
||||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db as ldb
|
from neutron_lbaas.db.loadbalancer import loadbalancer_db as ldb
|
||||||
from neutron_lbaas.services.loadbalancer import (
|
from neutron_lbaas.services.loadbalancer import (
|
||||||
plugin as loadbalancer_plugin
|
plugin as loadbalancer_plugin
|
||||||
)
|
)
|
||||||
from neutron_lbaas.services.loadbalancer.drivers import abstract_driver
|
from neutron_lbaas.services.loadbalancer.drivers import abstract_driver
|
||||||
|
from neutron_lbaas import tests
|
||||||
|
|
||||||
|
|
||||||
DB_CORE_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
|
DB_CORE_PLUGIN_KLASS = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
|
||||||
DB_LB_PLUGIN_KLASS = (
|
DB_LB_PLUGIN_KLASS = (
|
||||||
"neutron.services.loadbalancer."
|
"neutron_lbaas.services.loadbalancer."
|
||||||
"plugin.LoadBalancerPlugin"
|
"plugin.LoadBalancerPlugin"
|
||||||
)
|
)
|
||||||
NOOP_DRIVER_KLASS = ('neutron.tests.unit.db.loadbalancer.test_db_loadbalancer.'
|
NOOP_DRIVER_KLASS = ('neutron_lbaas.tests.unit.db.loadbalancer.'
|
||||||
'NoopLbaaSDriver')
|
'test_db_loadbalancer.NoopLbaaSDriver')
|
||||||
|
|
||||||
extensions_path = ':'.join(neutron.extensions.__path__)
|
extensions_path = ':'.join(neutron.extensions.__path__)
|
||||||
|
|
||||||
@ -301,6 +303,7 @@ class LoadBalancerPluginDbTestCase(LoadBalancerTestMixin,
|
|||||||
test_db_plugin.NeutronDbPluginV2TestCase):
|
test_db_plugin.NeutronDbPluginV2TestCase):
|
||||||
def setUp(self, core_plugin=None, lb_plugin=None, lbaas_provider=None,
|
def setUp(self, core_plugin=None, lb_plugin=None, lbaas_provider=None,
|
||||||
ext_mgr=None):
|
ext_mgr=None):
|
||||||
|
tests.override_nvalues()
|
||||||
service_plugins = {'lb_plugin_name': DB_LB_PLUGIN_KLASS}
|
service_plugins = {'lb_plugin_name': DB_LB_PLUGIN_KLASS}
|
||||||
if not lbaas_provider:
|
if not lbaas_provider:
|
||||||
lbaas_provider = (
|
lbaas_provider = (
|
||||||
@ -316,7 +319,6 @@ class LoadBalancerPluginDbTestCase(LoadBalancerTestMixin,
|
|||||||
ext_mgr=ext_mgr,
|
ext_mgr=ext_mgr,
|
||||||
service_plugins=service_plugins
|
service_plugins=service_plugins
|
||||||
)
|
)
|
||||||
|
|
||||||
if not ext_mgr:
|
if not ext_mgr:
|
||||||
self.plugin = loadbalancer_plugin.LoadBalancerPlugin()
|
self.plugin = loadbalancer_plugin.LoadBalancerPlugin()
|
||||||
ext_mgr = extensions.PluginAwareExtensionManager(
|
ext_mgr = extensions.PluginAwareExtensionManager(
|
||||||
@ -327,7 +329,7 @@ class LoadBalancerPluginDbTestCase(LoadBalancerTestMixin,
|
|||||||
self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
|
self.ext_api = extensions.ExtensionMiddleware(app, ext_mgr=ext_mgr)
|
||||||
|
|
||||||
get_lbaas_agent_patcher = mock.patch(
|
get_lbaas_agent_patcher = mock.patch(
|
||||||
'neutron.services.loadbalancer.agent_scheduler'
|
'neutron_lbaas.services.loadbalancer.agent_scheduler'
|
||||||
'.LbaasAgentSchedulerDbMixin.get_lbaas_agent_hosting_pool')
|
'.LbaasAgentSchedulerDbMixin.get_lbaas_agent_hosting_pool')
|
||||||
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
|
||||||
@ -639,7 +641,7 @@ class TestLoadBalancer(LoadBalancerPluginDbTestCase):
|
|||||||
prov1 = (constants.LOADBALANCER +
|
prov1 = (constants.LOADBALANCER +
|
||||||
':lbaas:' + NOOP_DRIVER_KLASS)
|
':lbaas:' + NOOP_DRIVER_KLASS)
|
||||||
prov2 = (constants.LOADBALANCER +
|
prov2 = (constants.LOADBALANCER +
|
||||||
':haproxy:neutron.services.loadbalancer.'
|
':haproxy:neutron_lbaas.services.loadbalancer.'
|
||||||
'drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver'
|
'drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver'
|
||||||
':default')
|
':default')
|
||||||
cfg.CONF.set_override('service_provider',
|
cfg.CONF.set_override('service_provider',
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import mock
|
import mock
|
||||||
|
from neutron.tests import base
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.tests import base
|
|
||||||
from neutron_lbaas.services.loadbalancer.agent import agent
|
from neutron_lbaas.services.loadbalancer.agent import agent
|
||||||
|
|
||||||
|
|
@ -15,9 +15,9 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
from neutron_lbaas.services.loadbalancer.agent import agent_manager as manager
|
from neutron_lbaas.services.loadbalancer.agent import agent_manager as manager
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class TestManager(base.BaseTestCase):
|
|||||||
self.mock_importer = mock.patch.object(manager, 'importutils').start()
|
self.mock_importer = mock.patch.object(manager, 'importutils').start()
|
||||||
|
|
||||||
rpc_mock_cls = mock.patch(
|
rpc_mock_cls = mock.patch(
|
||||||
'neutron.services.loadbalancer.agent.agent_api.LbaasAgentApi'
|
'neutron_lbaas.services.loadbalancer.agent.agent_api.LbaasAgentApi'
|
||||||
).start()
|
).start()
|
||||||
|
|
||||||
# disable setting up periodic state reporting
|
# disable setting up periodic state reporting
|
@ -15,8 +15,8 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import copy
|
import copy
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
from neutron_lbaas.services.loadbalancer.agent import agent_api as api
|
from neutron_lbaas.services.loadbalancer.agent import agent_api as api
|
||||||
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db as lb_db
|
from neutron_lbaas.db.loadbalancer import loadbalancer_db as lb_db
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
with mock.patch.dict(sys.modules, {'a10_neutron_lbaas': mock.Mock()}):
|
with mock.patch.dict(sys.modules, {'a10_neutron_lbaas': mock.Mock()}):
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.a10networks \
|
from neutron_lbaas.services.loadbalancer.drivers.a10networks \
|
||||||
import driver_v1
|
import driver_v1
|
@ -13,9 +13,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from neutron.tests import base
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.tests import base
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.embrane import config # noqa
|
from neutron_lbaas.services.loadbalancer.drivers.embrane import config # noqa
|
||||||
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from neutron import context
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo.db import exception as n_exc
|
from oslo.db import exception as n_exc
|
||||||
|
|
||||||
from neutron import context
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
|
|
||||||
HELEOSAPIMOCK = mock.Mock()
|
HELEOSAPIMOCK = mock.Mock()
|
||||||
sys.modules["heleosapi"] = HELEOSAPIMOCK
|
sys.modules["heleosapi"] = HELEOSAPIMOCK
|
||||||
@ -31,7 +31,7 @@ from neutron_lbaas.services.loadbalancer.drivers.embrane import db as h_db
|
|||||||
# Stop the mock from persisting indefinitely in the global modules space
|
# Stop the mock from persisting indefinitely in the global modules space
|
||||||
del sys.modules["heleosapi"]
|
del sys.modules["heleosapi"]
|
||||||
|
|
||||||
EMBRANE_PROVIDER = ('LOADBALANCER:lbaas:neutron.services.'
|
EMBRANE_PROVIDER = ('LOADBALANCER:lbaas:neutron_lbaas.services.'
|
||||||
'loadbalancer.drivers.embrane.driver.'
|
'loadbalancer.drivers.embrane.driver.'
|
||||||
'EmbraneLbaas:default')
|
'EmbraneLbaas:default')
|
||||||
|
|
@ -16,21 +16,21 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.haproxy import cfg
|
from neutron_lbaas.services.loadbalancer.drivers.haproxy import cfg
|
||||||
|
|
||||||
|
|
||||||
class TestHaproxyCfg(base.BaseTestCase):
|
class TestHaproxyCfg(base.BaseTestCase):
|
||||||
def test_save_config(self):
|
def test_save_config(self):
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
mock.patch('neutron.services.loadbalancer.'
|
mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'drivers.haproxy.cfg._build_global'),
|
'drivers.haproxy.cfg._build_global'),
|
||||||
mock.patch('neutron.services.loadbalancer.'
|
mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'drivers.haproxy.cfg._build_defaults'),
|
'drivers.haproxy.cfg._build_defaults'),
|
||||||
mock.patch('neutron.services.loadbalancer.'
|
mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'drivers.haproxy.cfg._build_frontend'),
|
'drivers.haproxy.cfg._build_frontend'),
|
||||||
mock.patch('neutron.services.loadbalancer.'
|
mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'drivers.haproxy.cfg._build_backend'),
|
'drivers.haproxy.cfg._build_backend'),
|
||||||
mock.patch('neutron.agent.linux.utils.replace_file')
|
mock.patch('neutron.agent.linux.utils.replace_file')
|
||||||
) as (b_g, b_d, b_f, b_b, replace):
|
) as (b_g, b_d, b_f, b_b, replace):
|
@ -15,9 +15,9 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.haproxy \
|
from neutron_lbaas.services.loadbalancer.drivers.haproxy \
|
||||||
import namespace_driver
|
import namespace_driver
|
||||||
|
|
@ -13,12 +13,13 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.logging_noop import driver
|
|
||||||
|
|
||||||
log_path = 'neutron.services.loadbalancer.drivers.logging_noop.driver.LOG'
|
from neutron_lbaas.services.loadbalancer.drivers.logging_noop import driver
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
|
|
||||||
|
log_path = ('neutron_lbaas.services.loadbalancer.drivers.'
|
||||||
|
'logging_noop.driver.LOG')
|
||||||
|
|
||||||
|
|
||||||
class FakeModel(object):
|
class FakeModel(object):
|
@ -13,14 +13,14 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
from neutron.tests.unit import testlib_api
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from neutron.tests.unit import testlib_api
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler \
|
from neutron_lbaas.services.loadbalancer.drivers.netscaler \
|
||||||
import netscaler_driver
|
import netscaler_driver
|
||||||
|
|
||||||
NCC_CLIENT_CLASS = ('neutron.services.loadbalancer.drivers'
|
NCC_CLIENT_CLASS = ('neutron_lbaas.services.loadbalancer.drivers'
|
||||||
'.netscaler.ncc_client.NSClient')
|
'.netscaler.ncc_client.NSClient')
|
||||||
|
|
||||||
TESTURI_SCHEME = 'http'
|
TESTURI_SCHEME = 'http'
|
@ -15,23 +15,23 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db
|
from neutron_lbaas.db.loadbalancer import loadbalancer_db
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
from neutron_lbaas.services.loadbalancer.drivers.netscaler import ncc_client
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.netscaler \
|
from neutron_lbaas.services.loadbalancer.drivers.netscaler \
|
||||||
import netscaler_driver
|
import netscaler_driver
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
|
|
||||||
|
|
||||||
LBAAS_DRIVER_CLASS = ('neutron.services.loadbalancer.drivers'
|
LBAAS_DRIVER_CLASS = ('neutron_lbaas.services.loadbalancer.drivers'
|
||||||
'.netscaler.netscaler_driver'
|
'.netscaler.netscaler_driver'
|
||||||
'.NetScalerPluginDriver')
|
'.NetScalerPluginDriver')
|
||||||
|
|
||||||
NCC_CLIENT_CLASS = ('neutron.services.loadbalancer.drivers'
|
NCC_CLIENT_CLASS = ('neutron_lbaas.services.loadbalancer.drivers'
|
||||||
'.netscaler.ncc_client'
|
'.netscaler.ncc_client'
|
||||||
'.NSClient')
|
'.NSClient')
|
||||||
|
|
@ -16,19 +16,19 @@ import re
|
|||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
|
||||||
from oslo.serialization import jsonutils
|
|
||||||
from six.moves import queue as Queue
|
|
||||||
|
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.extensions import loadbalancer
|
from neutron.extensions import loadbalancer
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
from oslo.config import cfg
|
||||||
|
from oslo.serialization import jsonutils
|
||||||
|
from six.moves import queue as Queue
|
||||||
|
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.radware import driver
|
from neutron_lbaas.services.loadbalancer.drivers.radware import driver
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.radware \
|
from neutron_lbaas.services.loadbalancer.drivers.radware \
|
||||||
import exceptions as r_exc
|
import exceptions as r_exc
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
|
|
||||||
GET_200 = ('/api/workflow/', '/api/service/', '/api/workflowTemplate')
|
GET_200 = ('/api/workflow/', '/api/service/', '/api/workflowTemplate')
|
||||||
SERVER_DOWN_CODES = (-1, 301, 307)
|
SERVER_DOWN_CODES = (-1, 301, 307)
|
||||||
@ -96,7 +96,7 @@ def _post_handler(resource, binary):
|
|||||||
else:
|
else:
|
||||||
return 202, '', '', ''
|
return 202, '', '', ''
|
||||||
|
|
||||||
RADWARE_PROVIDER = ('LOADBALANCER:radware:neutron.services.'
|
RADWARE_PROVIDER = ('LOADBALANCER:radware:neutron_lbaas.services.'
|
||||||
'loadbalancer.drivers.radware.driver.'
|
'loadbalancer.drivers.radware.driver.'
|
||||||
'LoadBalancerDriver:default')
|
'LoadBalancerDriver:default')
|
||||||
|
|
@ -15,9 +15,6 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from six import moves
|
|
||||||
from webob import exc
|
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron.db import servicetype_db as st_db
|
from neutron.db import servicetype_db as st_db
|
||||||
from neutron.extensions import loadbalancer
|
from neutron.extensions import loadbalancer
|
||||||
@ -26,11 +23,14 @@ from neutron import manager
|
|||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
from neutron.tests.unit import testlib_api
|
from neutron.tests.unit import testlib_api
|
||||||
|
from six import moves
|
||||||
|
from webob import exc
|
||||||
|
|
||||||
from neutron_lbaas.db.loadbalancer import loadbalancer_db as ldb
|
from neutron_lbaas.db.loadbalancer import loadbalancer_db as ldb
|
||||||
from neutron_lbaas.services.loadbalancer.drivers.common \
|
from neutron_lbaas.services.loadbalancer.drivers.common \
|
||||||
import agent_driver_base
|
import agent_driver_base
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
|
|
||||||
|
|
||||||
class TestLoadBalancerPluginBase(
|
class TestLoadBalancerPluginBase(
|
||||||
@ -48,7 +48,7 @@ class TestLoadBalancerPluginBase(
|
|||||||
st_db.ServiceTypeManager._instance = None
|
st_db.ServiceTypeManager._instance = None
|
||||||
agent_driver_base.AgentDriverBase.device_driver = 'dummy'
|
agent_driver_base.AgentDriverBase.device_driver = 'dummy'
|
||||||
super(TestLoadBalancerPluginBase, self).setUp(
|
super(TestLoadBalancerPluginBase, self).setUp(
|
||||||
lbaas_provider=('LOADBALANCER:lbaas:neutron.services.'
|
lbaas_provider=('LOADBALANCER:lbaas:neutron_lbaas.services.'
|
||||||
'loadbalancer.drivers.common.agent_driver_base.'
|
'loadbalancer.drivers.common.agent_driver_base.'
|
||||||
'AgentDriverBase:default'))
|
'AgentDriverBase:default'))
|
||||||
|
|
||||||
@ -66,14 +66,14 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
|||||||
self.plugin_instance
|
self.plugin_instance
|
||||||
)
|
)
|
||||||
get_lbaas_agents_patcher = mock.patch(
|
get_lbaas_agents_patcher = mock.patch(
|
||||||
'neutron.services.loadbalancer.agent_scheduler'
|
'neutron_lbaas.services.loadbalancer.agent_scheduler'
|
||||||
'.LbaasAgentSchedulerDbMixin.get_lbaas_agents')
|
'.LbaasAgentSchedulerDbMixin.get_lbaas_agents')
|
||||||
get_lbaas_agents_patcher.start()
|
get_lbaas_agents_patcher.start()
|
||||||
|
|
||||||
def test_get_ready_devices(self):
|
def test_get_ready_devices(self):
|
||||||
with self.vip() as vip:
|
with self.vip() as vip:
|
||||||
with mock.patch('neutron.services.loadbalancer.agent_scheduler'
|
with mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'.LbaasAgentSchedulerDbMixin.'
|
'agent_scheduler.LbaasAgentSchedulerDbMixin.'
|
||||||
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
||||||
mock_agent_pools.return_value = {
|
mock_agent_pools.return_value = {
|
||||||
'pools': [{'id': vip['vip']['pool_id']}]}
|
'pools': [{'id': vip['vip']['pool_id']}]}
|
||||||
@ -121,7 +121,7 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
|||||||
|
|
||||||
self.assertEqual(ctx.session.query(ldb.Pool).count(), 3)
|
self.assertEqual(ctx.session.query(ldb.Pool).count(), 3)
|
||||||
self.assertEqual(ctx.session.query(ldb.Vip).count(), 2)
|
self.assertEqual(ctx.session.query(ldb.Vip).count(), 2)
|
||||||
with mock.patch('neutron.services.loadbalancer.agent_scheduler'
|
with mock.patch('neutron_lbaas.services.loadbalancer.agent_scheduler'
|
||||||
'.LbaasAgentSchedulerDbMixin'
|
'.LbaasAgentSchedulerDbMixin'
|
||||||
'.list_pools_on_lbaas_agent') as mock_agent_pools:
|
'.list_pools_on_lbaas_agent') as mock_agent_pools:
|
||||||
mock_agent_pools.return_value = {'pools': [{'id': pools[0].id},
|
mock_agent_pools.return_value = {'pools': [{'id': pools[0].id},
|
||||||
@ -146,8 +146,8 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
|||||||
vip['vip']['id'],
|
vip['vip']['id'],
|
||||||
{'vip': {'status': constants.INACTIVE}}
|
{'vip': {'status': constants.INACTIVE}}
|
||||||
)
|
)
|
||||||
with mock.patch('neutron.services.loadbalancer.agent_scheduler'
|
with mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'.LbaasAgentSchedulerDbMixin.'
|
'agent_scheduler.LbaasAgentSchedulerDbMixin.'
|
||||||
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
||||||
mock_agent_pools.return_value = {
|
mock_agent_pools.return_value = {
|
||||||
'pools': [{'id': vip['vip']['pool_id']}]}
|
'pools': [{'id': vip['vip']['pool_id']}]}
|
||||||
@ -166,8 +166,8 @@ class TestLoadBalancerCallbacks(TestLoadBalancerPluginBase):
|
|||||||
vip['vip']['pool_id'],
|
vip['vip']['pool_id'],
|
||||||
{'pool': {'status': constants.INACTIVE}}
|
{'pool': {'status': constants.INACTIVE}}
|
||||||
)
|
)
|
||||||
with mock.patch('neutron.services.loadbalancer.agent_scheduler'
|
with mock.patch('neutron_lbaas.services.loadbalancer.'
|
||||||
'.LbaasAgentSchedulerDbMixin.'
|
'agent_scheduler.LbaasAgentSchedulerDbMixin.'
|
||||||
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
'list_pools_on_lbaas_agent') as mock_agent_pools:
|
||||||
mock_agent_pools.return_value = {
|
mock_agent_pools.return_value = {
|
||||||
'pools': [{'id': vip['vip']['pool_id']}]}
|
'pools': [{'id': vip['vip']['pool_id']}]}
|
@ -14,9 +14,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
|
||||||
from webob import exc
|
|
||||||
|
|
||||||
from neutron.api import extensions
|
from neutron.api import extensions
|
||||||
from neutron.api.v2 import attributes
|
from neutron.api.v2 import attributes
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
@ -27,11 +24,15 @@ from neutron.extensions import lbaas_agentscheduler
|
|||||||
from neutron.extensions import loadbalancer
|
from neutron.extensions import loadbalancer
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.plugins.common import constants as plugin_const
|
from neutron.plugins.common import constants as plugin_const
|
||||||
from neutron.tests.unit.db.loadbalancer import test_db_loadbalancer
|
|
||||||
from neutron.tests.unit.openvswitch import test_agent_scheduler
|
from neutron.tests.unit.openvswitch import test_agent_scheduler
|
||||||
from neutron.tests.unit import test_agent_ext_plugin
|
from neutron.tests.unit import test_agent_ext_plugin
|
||||||
from neutron.tests.unit import test_db_plugin as test_plugin
|
from neutron.tests.unit import test_db_plugin as test_plugin
|
||||||
from neutron.tests.unit import test_extensions
|
from neutron.tests.unit import test_extensions
|
||||||
|
from oslo.config import cfg
|
||||||
|
from webob import exc
|
||||||
|
|
||||||
|
from neutron_lbaas import tests
|
||||||
|
from neutron_lbaas.tests.unit.db.loadbalancer import test_db_loadbalancer
|
||||||
|
|
||||||
LBAAS_HOSTA = 'hosta'
|
LBAAS_HOSTA = 'hosta'
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ class LBaaSAgentSchedulerTestCase(test_agent_ext_plugin.AgentDBTestMixIn,
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# Save the global RESOURCE_ATTRIBUTE_MAP
|
# Save the global RESOURCE_ATTRIBUTE_MAP
|
||||||
|
tests.override_nvalues()
|
||||||
self.saved_attr_map = {}
|
self.saved_attr_map = {}
|
||||||
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
|
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
|
||||||
self.saved_attr_map[resource] = attrs.copy()
|
self.saved_attr_map[resource] = attrs.copy()
|
||||||
@ -74,7 +76,7 @@ class LBaaSAgentSchedulerTestCase(test_agent_ext_plugin.AgentDBTestMixIn,
|
|||||||
#default provider should support agent scheduling
|
#default provider should support agent scheduling
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'service_provider',
|
'service_provider',
|
||||||
[('LOADBALANCER:lbaas:neutron.services.'
|
[('LOADBALANCER:lbaas:neutron_lbaas.services.'
|
||||||
'loadbalancer.drivers.haproxy.plugin_driver.'
|
'loadbalancer.drivers.haproxy.plugin_driver.'
|
||||||
'HaproxyOnHostPluginDriver:default')],
|
'HaproxyOnHostPluginDriver:default')],
|
||||||
'service_providers')
|
'service_providers')
|
@ -16,14 +16,15 @@
|
|||||||
import copy
|
import copy
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from webob import exc
|
|
||||||
|
|
||||||
from neutron.api.v2 import attributes as attr
|
from neutron.api.v2 import attributes as attr
|
||||||
from neutron.extensions import loadbalancer
|
from neutron.extensions import loadbalancer
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
from neutron.tests.unit import test_api_v2
|
from neutron.tests.unit import test_api_v2
|
||||||
from neutron.tests.unit import test_api_v2_extension
|
from neutron.tests.unit import test_api_v2_extension
|
||||||
|
from webob import exc
|
||||||
|
|
||||||
|
from neutron_lbaas import tests
|
||||||
|
|
||||||
|
|
||||||
_uuid = uuidutils.generate_uuid
|
_uuid = uuidutils.generate_uuid
|
||||||
@ -35,6 +36,7 @@ class LoadBalancerExtensionTestCase(test_api_v2_extension.ExtensionTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(LoadBalancerExtensionTestCase, self).setUp()
|
super(LoadBalancerExtensionTestCase, self).setUp()
|
||||||
|
tests.override_nvalues()
|
||||||
self._setUpExtension(
|
self._setUpExtension(
|
||||||
'neutron.extensions.loadbalancer.LoadBalancerPluginBase',
|
'neutron.extensions.loadbalancer.LoadBalancerPluginBase',
|
||||||
constants.LOADBALANCER, loadbalancer.RESOURCE_ATTRIBUTE_MAP,
|
constants.LOADBALANCER, loadbalancer.RESOURCE_ATTRIBUTE_MAP,
|
@ -13,12 +13,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
from neutron import context
|
from neutron import context
|
||||||
from neutron import quota
|
from neutron import quota
|
||||||
from neutron.tests.unit import test_api_v2
|
from neutron.tests.unit import test_api_v2
|
||||||
from neutron.tests.unit import test_quota_ext
|
from neutron.tests.unit import test_quota_ext
|
||||||
|
from oslo.config import cfg
|
||||||
|
|
||||||
|
from neutron_lbaas import tests
|
||||||
|
|
||||||
_get_path = test_api_v2._get_path
|
_get_path = test_api_v2._get_path
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ class LBaaSQuotaExtensionTestCase(
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(LBaaSQuotaExtensionTestCase, self).setUp()
|
super(LBaaSQuotaExtensionTestCase, self).setUp()
|
||||||
|
tests.override_nvalues()
|
||||||
cfg.CONF.set_override(
|
cfg.CONF.set_override(
|
||||||
'quota_items',
|
'quota_items',
|
||||||
['vip', 'pool', 'member', 'health_monitor', 'extra1'],
|
['vip', 'pool', 'member', 'health_monitor', 'extra1'],
|
@ -1,22 +0,0 @@
|
|||||||
# Copyright 2012 OpenStack Foundation.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
|
|
||||||
class FakeTest(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_true(self):
|
|
||||||
self.assertTrue(True)
|
|
Loading…
Reference in New Issue
Block a user