]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix TestNecAgentMain not to call sys.exit()
authorRoman Bogorodskiy <rbogorodskiy@mirantis.com>
Tue, 18 Jun 2013 17:12:27 +0000 (13:12 -0400)
committerRoman Bogorodskiy <rbogorodskiy@mirantis.com>
Wed, 19 Jun 2013 06:00:27 +0000 (02:00 -0400)
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
quantum/tests/unit/nec/test_nec_agent.py

index 00f1dd687cb604e69dbbc8fad61dd18215440475..ab34062ada472e28677838c668313d17058d3d47 100755 (executable)
@@ -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()
index 03694fb201662b9d71f448023327d8f73718ceb1..a6d395f1ebbd4bfdb610424a61414c3eaf59fecf 100644 (file)
@@ -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()