Reduce logging level for UTs
We are also patching a number of modules to reduce the logging level from warning to info (only for UTs) to reduce the noise in the UT logs. Change-Id: I9803a12f66d50e9281c37fd6a026965dd47ba255
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# 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 neutron._i18n import _LI
|
||||
from neutron.agent import securitygroups_rpc
|
||||
from neutron.api import extensions
|
||||
from neutron.quota import resource_registry
|
||||
from neutron.scheduler import l3_agent_scheduler
|
||||
from stevedore import named
|
||||
|
||||
from gbpservice.network.neutronv2 import local_api
|
||||
|
||||
|
||||
# The following is to avoid excessive logging in the UTs
|
||||
extensions._LW = extensions._LI
|
||||
l3_agent_scheduler._LW = _LI
|
||||
securitygroups_rpc._LW = securitygroups_rpc._LI
|
||||
resource_registry._LW = resource_registry._LI
|
||||
local_api._LW = _LI
|
||||
extensions.LOG.warning = extensions.LOG.info
|
||||
resource_registry.LOG.warning = resource_registry.LOG.info
|
||||
l3_agent_scheduler.LOG.warning = l3_agent_scheduler.LOG.info
|
||||
securitygroups_rpc.LOG.warning = securitygroups_rpc.LOG.info
|
||||
local_api.LOG.warning = local_api.LOG.info
|
||||
named.LOG.warning = named.LOG.info
|
||||
|
||||
@@ -373,6 +373,15 @@ class GroupPolicyDbTestCase(GroupPolicyDBTestBase,
|
||||
self._sc_plugin = plugins.get(constants.SERVICECHAIN)
|
||||
self._l3_plugin = plugins.get(constants.L3_ROUTER_NAT)
|
||||
self._set_notification_mocks()
|
||||
# The following is done to stop the neutron code from checking
|
||||
# for dhcp agents
|
||||
if '_aliases' in plugins.get('CORE').__dict__:
|
||||
if 'agent' in plugins.get('CORE').__dict__['_aliases']:
|
||||
plugins.get('CORE').__dict__['_aliases'].remove('agent')
|
||||
if 'dhcp_agent_scheduler' in plugins.get('CORE').__dict__[
|
||||
'_aliases']:
|
||||
plugins.get('CORE').__dict__['_aliases'].remove(
|
||||
'dhcp_agent_scheduler')
|
||||
|
||||
def tearDown(self):
|
||||
self._unset_notification_mocks()
|
||||
|
||||
@@ -25,3 +25,13 @@ from oslo_db.sqlalchemy import utils as sa_utils
|
||||
# REVISIT: Remove this as soon as possible.
|
||||
if not hasattr(sa_utils, '_get_unique_keys'):
|
||||
sa_utils._get_unique_keys = sa_utils.get_unique_keys
|
||||
|
||||
|
||||
from neutron._i18n import _LI
|
||||
|
||||
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import cache
|
||||
|
||||
|
||||
# The following is to avoid excessive logging in the UTs
|
||||
cache._LW = _LI
|
||||
cache.LOG.warning = cache.LOG.info
|
||||
|
||||
@@ -210,6 +210,15 @@ class ApicAimTestCase(test_address_scope.AddressScopeTestCase,
|
||||
self.t1_aname)
|
||||
self.dn_t1_l2_n2 = ('uni/tn-%s/out-l2/instP-n2' %
|
||||
self.t1_aname)
|
||||
# The following is done to stop the neutron code from checking
|
||||
# for dhcp agents
|
||||
if '_aliases' in self.plugin.__dict__:
|
||||
if 'agent' in self.plugin.__dict__['_aliases']:
|
||||
self.plugin.__dict__['_aliases'].remove('agent')
|
||||
if 'dhcp_agent_scheduler' in self.plugin.__dict__[
|
||||
'_aliases']:
|
||||
self.plugin.__dict__['_aliases'].remove(
|
||||
'dhcp_agent_scheduler')
|
||||
|
||||
def tearDown(self):
|
||||
engine = db_api.get_engine()
|
||||
|
||||
@@ -15,8 +15,10 @@ import mock
|
||||
from neutron import context
|
||||
from neutron.tests.unit.plugins.ml2 import test_plugin
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import webob.exc
|
||||
|
||||
from gbpservice._i18n import _LW
|
||||
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpmdb
|
||||
from gbpservice.neutron.extensions import group_policy as gpolicy
|
||||
from gbpservice.neutron.services.grouppolicy import config
|
||||
@@ -28,6 +30,7 @@ from gbpservice.neutron.tests.unit.db.grouppolicy import (
|
||||
test_group_policy_mapping_db as tgpmdb)
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
cfg.CONF.import_opt('policy_drivers',
|
||||
'gbpservice.neutron.services.grouppolicy.config',
|
||||
group='group_policy')
|
||||
@@ -160,6 +163,9 @@ class GroupPolicyPluginTestBase(tgpmdb.GroupPolicyMappingDbTestCase):
|
||||
class GroupPolicyPluginTestCase(GroupPolicyPluginTestBase):
|
||||
|
||||
def tearDown(self):
|
||||
policy_drivers = cfg.CONF.group_policy.policy_drivers
|
||||
LOG.warning(_LW("PDs used in this test: %s"),
|
||||
policy_drivers)
|
||||
# Always reset configuration to dummy driver. Any
|
||||
# test which requires to configure a different
|
||||
# policy driver would have done so in it's setup
|
||||
|
||||
Reference in New Issue
Block a user