Dan Kenigsberg has submitted this change and it was merged. Change subject: tests: Silence momPolicyTests ......................................................................
tests: Silence momPolicyTests Each momPolicyTests test case was logging the same message 6 times when loading a policy file: 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,598 - mom.Policy - INFO - Loaded policy '00-defines' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' 2015-07-25 00:52:00,609 - mom.Policy - INFO - Loaded policy '04-cputune' To make debugging more interesting, these messages were not displayed when running only momPolicyTests.py. They are displayed only when running both momTests.py and momPolicyTests.py. Turns out that momTests.py has 6 test cases creating a mom server or client. Each time a server or client are created, a new logging.StreamHandler() was added to the "mom" logger. Since no cleanup was performed, when momTests.py finished, "mom" logger with 6 unwanted handlers writing to sys.stderr was left in the logging module. When loading mom policy, Policy logs a messages to "mom.Policy" logger, which propagates to mom logger and get written by all 6 handlers. This patch monkey-patches the root logger manager.loggerDict in momTests.py, so loggers added during the tests are dropped when the test ends. Without the "mom" logger, "mom.Policy" logs go the root logger, which is captured by nose, so these logs are available when a test fails. Change-Id: Ice082d703ac36e17a8f3ed3cc3b4e4b144265c27 Signed-off-by: Nir Soffer <[email protected]> Reviewed-on: https://gerrit.ovirt.org/43621 Continuous-Integration: Jenkins CI Reviewed-by: Roman Mohr <[email protected]> Reviewed-by: Dan Kenigsberg <[email protected]> --- M tests/momTests.py 1 file changed, 6 insertions(+), 0 deletions(-) Approvals: Nir Soffer: Verified Roman Mohr: Looks good to me, but someone else must approve Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved -- To view, visit https://gerrit.ovirt.org/43621 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ice082d703ac36e17a8f3ed3cc3b4e4b144265c27 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> Gerrit-Reviewer: Adam Litke <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Sivák <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Roman Mohr <[email protected]> Gerrit-Reviewer: Yaniv Bronhaim <[email protected]> Gerrit-Reviewer: [email protected] _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
