def daemon_loop(self): with polling.get_polling_manager( self.minimize_polling, self.root_helper, self.ovsdb_monitor_respawn_interval) as pm: LOG.debug("daemon_loop,pm=%s" % pm) self.rpc_loop(polling_manager=pm)
def test_manage_polling_minimizer(self): mock_target = 'neutron.agent.linux.polling.InterfacePollingMinimizer' with mock.patch('%s.start' % mock_target) as mock_start: with mock.patch('%s.stop' % mock_target) as mock_stop: with polling.get_polling_manager(minimize_polling=True) as pm: self.assertEqual(pm.__class__, polling.InterfacePollingMinimizer) mock_stop.assert_has_calls([mock.call()]) mock_start.assert_has_calls([mock.call()])
def test_manage_polling_minimizer(self): mock_target = 'neutron.agent.linux.polling.InterfacePollingMinimizer' with mock.patch('%s.start' % mock_target) as mock_start: with mock.patch('%s.stop' % mock_target) as mock_stop: with polling.get_polling_manager(minimize_polling=True) as pm: self.assertEqual(pm.__class__, polling.InterfacePollingMinimizer) mock_stop.assert_has_calls(mock.call()) mock_start.assert_has_calls(mock.call())
def test_manage_polling_minimizer(self): mock_target = "neutron.agent.linux.polling.InterfacePollingMinimizer" with mock.patch("%s.start" % mock_target) as mock_start: with mock.patch("%s.stop" % mock_target) as mock_stop: with polling.get_polling_manager(minimize_polling=True, root_helper="test") as pm: self.assertEqual(pm._monitor.root_helper, "test") self.assertEqual(pm.__class__, polling.InterfacePollingMinimizer) mock_stop.assert_has_calls(mock.call()) mock_start.assert_has_calls(mock.call())
def test_return_always_poll_by_default(self): with polling.get_polling_manager() as pm: self.assertEqual(pm.__class__, polling.AlwaysPoll)