Re-enable UT for neutron-fwaas for services split
- Renable UT along with some minor fixes for import issues. Change-Id: I5abacda42074ed23a005939256fbb606cecb9cc6 Partially-Implements: blueprint services-split
This commit is contained in:
parent
cb418a3ead
commit
ea07947830
|
@ -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,44 @@
|
|||
# Copyright 2014 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 os
|
||||
|
||||
import neutron
|
||||
from neutron.tests import base as n_base
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
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)
|
||||
|
||||
|
||||
class BaseTestCase(n_base.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
override_nvalues()
|
||||
super(BaseTestCase, self).setUp()
|
||||
|
||||
|
||||
class NeutronDbPluginV2TestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
|
||||
def setUp(self, plugin=None, service_plugins=None, ext_mgr=None):
|
||||
override_nvalues()
|
||||
super(NeutronDbPluginV2TestCase, self).setUp(
|
||||
plugin, service_plugins, ext_mgr)
|
|
@ -29,15 +29,14 @@ from neutron.extensions import firewall
|
|||
from neutron import manager
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
from neutron_fwaas.db.firewall import firewall_db as fdb
|
||||
from neutron_fwaas.services.firewall import fwaas_plugin
|
||||
|
||||
from neutron_fwaas.tests import base
|
||||
|
||||
DB_FW_PLUGIN_KLASS = (
|
||||
"neutron.db.firewall.firewall_db.Firewall_db_mixin"
|
||||
"neutron_fwaas.db.firewall.firewall_db.Firewall_db_mixin"
|
||||
)
|
||||
FWAAS_PLUGIN = 'neutron.services.firewall.fwaas_plugin'
|
||||
FWAAS_PLUGIN = 'neutron_fwaas.services.firewall.fwaas_plugin'
|
||||
DELETEFW_PATH = FWAAS_PLUGIN + '.FirewallAgentApi.delete_firewall'
|
||||
extensions_path = ':'.join(neutron.extensions.__path__)
|
||||
DESCRIPTION = 'default description'
|
||||
|
@ -71,7 +70,7 @@ class FakeAgentApi(fwaas_plugin.FirewallCallbacks):
|
|||
self.firewall_deleted(context, firewall['id'], **kwargs)
|
||||
|
||||
|
||||
class FirewallPluginDbTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
class FirewallPluginDbTestCase(base.NeutronDbPluginV2TestCase):
|
||||
resource_prefix_map = dict(
|
||||
(k, constants.COMMON_PREFIXES[constants.FIREWALL])
|
||||
for k in firewall.RESOURCE_ATTRIBUTE_MAP.keys()
|
|
@ -26,12 +26,12 @@ from neutron.agent.linux import ip_lib
|
|||
from neutron.common import config as base_config
|
||||
from neutron import context
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.services.firewall.agents \
|
||||
import test_firewall_agent_api
|
||||
from neutron_fwaas.services.firewall.agents import firewall_agent_api
|
||||
from neutron_fwaas.services.firewall.agents.l3reference \
|
||||
import firewall_l3_agent
|
||||
from neutron_fwaas.tests import base
|
||||
from neutron_fwaas.tests.unit.services.firewall.agents \
|
||||
import test_firewall_agent_api
|
||||
|
||||
|
||||
class FWaasHelper(object):
|
||||
|
@ -60,11 +60,13 @@ class TestFwaasL3AgentRpcCallback(base.BaseTestCase):
|
|||
self.conf.register_opts(agent.L3NATAgent.OPTS)
|
||||
self.conf.register_opts(ha.OPTS)
|
||||
agent_config.register_use_namespaces_opts_helper(self.conf)
|
||||
agent_config.register_root_helper(cfg.CONF)
|
||||
agent_config.register_root_helper(self.conf)
|
||||
self.conf.root_helper = 'sudo'
|
||||
self.conf.register_opts(firewall_agent_api.FWaaSOpts, 'fwaas')
|
||||
self.api = FWaasAgent(self.conf)
|
||||
self.api.fwaas_driver = test_firewall_agent_api.NoopFwaasDriver()
|
||||
self.adminContext = context.get_admin_context()
|
||||
|
||||
def test_fw_config_match(self):
|
||||
test_agent_class = _setup_test_agent_class([constants.FIREWALL])
|
|
@ -16,9 +16,9 @@
|
|||
import contextlib
|
||||
import mock
|
||||
|
||||
from neutron.tests import base
|
||||
from neutron_fwaas.services.firewall.agents import firewall_agent_api as api
|
||||
from neutron_fwaas.services.firewall.drivers import fwaas_base as base_driver
|
||||
from neutron_fwaas.tests import base
|
||||
|
||||
|
||||
class NoopFwaasDriver(base_driver.FwaasDriverBase):
|
|
@ -23,9 +23,10 @@ from neutron.agent.linux import interface
|
|||
from neutron.common import config as base_config
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.openstack.common import uuidutils
|
||||
from neutron.tests import base
|
||||
from neutron_fwaas.services.firewall.agents.varmour import varmour_router
|
||||
from neutron_fwaas.services.firewall.agents.varmour import varmour_utils
|
||||
from neutron_fwaas.tests import base
|
||||
|
||||
|
||||
_uuid = uuidutils.generate_uuid
|
||||
HOSTNAME = 'myhost'
|
|
@ -22,13 +22,13 @@ from webob import exc
|
|||
from neutron import context
|
||||
from neutron.extensions import firewall
|
||||
from neutron.plugins.common import constants as const
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit.db.firewall import test_db_firewall
|
||||
from neutron_fwaas.services.firewall import fwaas_plugin
|
||||
from neutron_fwaas.tests import base
|
||||
from neutron_fwaas.tests.unit.db.firewall import test_db_firewall
|
||||
|
||||
|
||||
FW_PLUGIN_KLASS = (
|
||||
"neutron.services.firewall.fwaas_plugin.FirewallPlugin"
|
||||
"neutron_fwaas.services.firewall.fwaas_plugin.FirewallPlugin"
|
||||
)
|
||||
|
||||
|
|
@ -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