From: Roman Bogorodskiy Date: Tue, 18 Jun 2013 17:12:27 +0000 (-0400) Subject: Fix TestNecAgentMain not to call sys.exit() X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=381cb1c4e4b5122a8afae67ad4cbeebcb39cbf83;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/quantum/plugins/nec/agent/nec_quantum_agent.py b/quantum/plugins/nec/agent/nec_quantum_agent.py index 00f1dd687..ab34062ad 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 03694fb20..a6d395f1e 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()