From 381cb1c4e4b5122a8afae67ad4cbeebcb39cbf83 Mon Sep 17 00:00:00 2001 From: Roman Bogorodskiy Date: Tue, 18 Jun 2013 13:12:27 -0400 Subject: [PATCH] Fix TestNecAgentMain not to call sys.exit() test_main() was calling sys.exit() killing test running and not allowing tests to complete in a proper way. Drop explicit sys.exit() call from net agent's main() and fix outdated mocks in test_main(). Fixes bug #1192270 Change-Id: Iea8d5508f73eb9144e452de3305f2dec4c2a319c --- quantum/plugins/nec/agent/nec_quantum_agent.py | 3 --- quantum/tests/unit/nec/test_nec_agent.py | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/quantum/plugins/nec/agent/nec_quantum_agent.py b/quantum/plugins/nec/agent/nec_quantum_agent.py index 00f1dd687c..ab34062ada 100755 --- a/quantum/plugins/nec/agent/nec_quantum_agent.py +++ b/quantum/plugins/nec/agent/nec_quantum_agent.py @@ -23,7 +23,6 @@ # @author: Akihiro MOTOKI import socket -import sys import time import eventlet @@ -242,8 +241,6 @@ def main(): # Start everything. agent.daemon_loop() - sys.exit(0) - if __name__ == "__main__": main() diff --git a/quantum/tests/unit/nec/test_nec_agent.py b/quantum/tests/unit/nec/test_nec_agent.py index 03694fb201..a6d395f1eb 100644 --- a/quantum/tests/unit/nec/test_nec_agent.py +++ b/quantum/tests/unit/nec/test_nec_agent.py @@ -290,12 +290,12 @@ class TestNecAgentMain(base.BaseTestCase): with contextlib.nested( mock.patch.object(nec_quantum_agent, 'NECQuantumAgent'), mock.patch('eventlet.monkey_patch'), - mock.patch('quantum.common.config'), + mock.patch.object(nec_quantum_agent, 'logging_config'), mock.patch.object(nec_quantum_agent, 'config') ) as (agent, eventlet, logging_config, cfg): - cfg.CONF.ovs.integration_bridge = 'br-int-x' - cfg.CONF.AGENT.root_helper = 'dummy-helper' - cfg.CONF.AGENT.polling_interval = 10 + cfg.OVS.integration_bridge = 'br-int-x' + cfg.AGENT.root_helper = 'dummy-helper' + cfg.AGENT.polling_interval = 10 nec_quantum_agent.main()