Make plugin deallocation check optional
The fix for memory leakage in the related bug added a check for plugin deallocation that performed a call to gc.collect() after every test. This had the side-effect of increasing test execution time by ~50%, so this patch makes the check optional via an environment variable (OS_CHECK_PLUGIN_DEALLOCATION). It may make sense to create a periodic job that runs with the check enabled, but otherwise the check can be used by developers for debugging purposes. Change-Id: I9ebe663abbc4e4ff3a62d807d5a3230c2ecccd07 Related-Bug: #1234857
This commit is contained in:
parent
f3c1eafdab
commit
70e0299ae8
@ -69,8 +69,17 @@ class BaseTestCase(testtools.TestCase):
|
||||
#TODO(marun) Fix plugins that do not properly initialize notifiers
|
||||
agentschedulers_db.AgentSchedulerDbMixin.agent_notifiers = {}
|
||||
|
||||
# Perform a check for deallocation only if explicitly
|
||||
# configured to do so since calling gc.collect() after every
|
||||
# test increases test suite execution time by ~50%.
|
||||
check_plugin_deallocation = (
|
||||
os.environ.get('OS_CHECK_PLUGIN_DEALLOCATION') in TRUE_STRING)
|
||||
if check_plugin_deallocation:
|
||||
plugin = weakref.ref(nm._instance.plugin)
|
||||
|
||||
nm.clear_instance()
|
||||
|
||||
if check_plugin_deallocation:
|
||||
gc.collect()
|
||||
|
||||
#TODO(marun) Ensure that mocks are deallocated?
|
||||
|
Loading…
x
Reference in New Issue
Block a user