Merge "Fix unnecessary logging messages during tests"
This commit is contained in:
@@ -6,8 +6,9 @@ from quantum.agent import netns_cleanup_util as util
|
|||||||
|
|
||||||
class TestNetnsCleanup(unittest.TestCase):
|
class TestNetnsCleanup(unittest.TestCase):
|
||||||
def test_setup_conf(self):
|
def test_setup_conf(self):
|
||||||
conf = util.setup_conf()
|
with mock.patch('quantum.common.config.setup_logging'):
|
||||||
self.assertFalse(conf.force)
|
conf = util.setup_conf()
|
||||||
|
self.assertFalse(conf.force)
|
||||||
|
|
||||||
def test_kill_dhcp(self, dhcp_active=True):
|
def test_kill_dhcp(self, dhcp_active=True):
|
||||||
conf = mock.Mock()
|
conf = mock.Mock()
|
||||||
|
|||||||
@@ -92,15 +92,20 @@ class TestDhcpAgent(unittest.TestCase):
|
|||||||
self.driver_cls_p.stop()
|
self.driver_cls_p.stop()
|
||||||
|
|
||||||
def test_dhcp_agent_main(self):
|
def test_dhcp_agent_main(self):
|
||||||
with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
|
logging_str = 'quantum.agent.common.config.setup_logging'
|
||||||
with mock.patch('quantum.agent.dhcp_agent.DhcpAgent') as dhcp:
|
manager_str = 'quantum.agent.dhcp_agent.DeviceManager'
|
||||||
with mock.patch('quantum.agent.dhcp_agent.sys') as mock_sys:
|
agent_str = 'quantum.agent.dhcp_agent.DhcpAgent'
|
||||||
mock_sys.argv = []
|
agent_sys_str = 'quantum.agent.dhcp_agent.sys'
|
||||||
dhcp_agent.main()
|
with mock.patch(logging_str):
|
||||||
dev_mgr.assert_called_once(mock.ANY, 'sudo')
|
with mock.patch(manager_str) as dev_mgr:
|
||||||
dhcp.assert_has_calls([
|
with mock.patch(agent_str) as dhcp:
|
||||||
mock.call(mock.ANY),
|
with mock.patch(agent_sys_str) as mock_sys:
|
||||||
mock.call().run()])
|
mock_sys.argv = []
|
||||||
|
dhcp_agent.main()
|
||||||
|
dev_mgr.assert_called_once(mock.ANY, 'sudo')
|
||||||
|
dhcp.assert_has_calls([
|
||||||
|
mock.call(mock.ANY),
|
||||||
|
mock.call().run()])
|
||||||
|
|
||||||
def test_run_completes_single_pass(self):
|
def test_run_completes_single_pass(self):
|
||||||
with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
|
with mock.patch('quantum.agent.dhcp_agent.DeviceManager') as dev_mgr:
|
||||||
|
|||||||
@@ -305,9 +305,9 @@ class TestBasicRouterOperations(unittest.TestCase):
|
|||||||
agent_mock_p = mock.patch('quantum.agent.l3_agent.L3NATAgent')
|
agent_mock_p = mock.patch('quantum.agent.l3_agent.L3NATAgent')
|
||||||
agent_mock = agent_mock_p.start()
|
agent_mock = agent_mock_p.start()
|
||||||
agent_mock.daemon_loop.return_value = None
|
agent_mock.daemon_loop.return_value = None
|
||||||
|
with mock.patch('quantum.agent.common.config.setup_logging'):
|
||||||
with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
|
with mock.patch('quantum.agent.l3_agent.sys') as mock_sys:
|
||||||
mock_sys.argv = []
|
mock_sys.argv = []
|
||||||
l3_agent.main()
|
l3_agent.main()
|
||||||
|
|
||||||
agent_mock_p.stop()
|
agent_mock_p.stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user