Sqlalchemy event unregistering failure in UTs
When running most of the UTs, log statements like the following: " No sqlalchemy event for resource router found " are being seen during the UT teardown stage. In the case of the py27 gate job it inundates the log and makes it difficult to find more relevant information. The log warnings are seen because the unregistering of events is attempted twice, and the warning is shown on the second instance. The unregsitering is triggered from the Neutron UT framework and there doesn't seem to be much control over this from GBP. This patch selectively suppresses these messages when running UTs, and the suppressing behavior is limited to the class and method where its considered redundant. Change-Id: I19e83d67b93cfeaa066ef8bd586df8662778dee3
This commit is contained in:
parent
5844567da1
commit
d331f0af97
|
@ -12,6 +12,7 @@
|
|||
from neutron._i18n import _LI
|
||||
from neutron.agent import securitygroups_rpc
|
||||
from neutron.api import extensions
|
||||
from neutron.quota import resource
|
||||
from neutron.quota import resource_registry
|
||||
from neutron.scheduler import l3_agent_scheduler
|
||||
from stevedore import named
|
||||
|
@ -31,3 +32,22 @@ 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
|
||||
|
||||
|
||||
import sys
|
||||
orig_warning = resource.LOG.warning
|
||||
|
||||
|
||||
def warning(*args):
|
||||
try:
|
||||
for val in sys._getframe(1).f_locals.itervalues():
|
||||
if isinstance(val, resource.TrackedResource) and (
|
||||
sys._getframe(1).f_code.co_name == (
|
||||
'unregister_events')):
|
||||
return
|
||||
except Exception:
|
||||
pass
|
||||
orig_warning(*args)
|
||||
|
||||
|
||||
resource.LOG.warning = warning
|
||||
|
|
Loading…
Reference in New Issue