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
This commit is contained in:
Roman Bogorodskiy 2013-06-18 13:12:27 -04:00
parent a0f8d5a354
commit 381cb1c4e4
2 changed files with 4 additions and 7 deletions

View File

@ -23,7 +23,6 @@
# @author: Akihiro MOTOKI # @author: Akihiro MOTOKI
import socket import socket
import sys
import time import time
import eventlet import eventlet
@ -242,8 +241,6 @@ def main():
# Start everything. # Start everything.
agent.daemon_loop() agent.daemon_loop()
sys.exit(0)
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -290,12 +290,12 @@ class TestNecAgentMain(base.BaseTestCase):
with contextlib.nested( with contextlib.nested(
mock.patch.object(nec_quantum_agent, 'NECQuantumAgent'), mock.patch.object(nec_quantum_agent, 'NECQuantumAgent'),
mock.patch('eventlet.monkey_patch'), 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') mock.patch.object(nec_quantum_agent, 'config')
) as (agent, eventlet, logging_config, cfg): ) as (agent, eventlet, logging_config, cfg):
cfg.CONF.ovs.integration_bridge = 'br-int-x' cfg.OVS.integration_bridge = 'br-int-x'
cfg.CONF.AGENT.root_helper = 'dummy-helper' cfg.AGENT.root_helper = 'dummy-helper'
cfg.CONF.AGENT.polling_interval = 10 cfg.AGENT.polling_interval = 10
nec_quantum_agent.main() nec_quantum_agent.main()