def test_listener_proc_heat(self, mock_listener, mock_transport, mock_target, mock_novaendpoint, mock_heatendpoint): x_listener = mock.Mock() mock_listener.return_value = x_listener x_transport = mock.Mock() mock_transport.return_value = x_transport x_target = mock.Mock() mock_target.return_value = x_target x_endpoint = mock.Mock() mock_heatendpoint.return_value = x_endpoint recover_action = {'operation': 'REBUILD'} res = hm.ListenerProc('heat', 'PROJECT_ID', 'CLUSTER_ID', recover_action) self.assertIsNone(res) mock_transport.assert_called_once_with(cfg.CONF) mock_target.assert_called_once_with(topic="notifications", exchange='heat') mock_heatendpoint.assert_called_once_with('PROJECT_ID', 'CLUSTER_ID', recover_action) mock_listener.assert_called_once_with(x_transport, [x_target], [x_endpoint], executor='threading', pool="senlin-listeners") x_listener.start.assert_called_once_with()
def test_listener_proc_nova(self, mock_listener, mock_transport, mock_target, mock_novaendpoint, mock_heatendpoint): cfg.CONF.set_override('nova_control_exchange', 'FAKE_EXCHANGE', group='health_manager', enforce_type=True) x_listener = mock.Mock() mock_listener.return_value = x_listener x_transport = mock.Mock() mock_transport.return_value = x_transport x_target = mock.Mock() mock_target.return_value = x_target x_endpoint = mock.Mock() mock_novaendpoint.return_value = x_endpoint res = hm.ListenerProc('FAKE_EXCHANGE', 'PROJECT_ID', 'CLUSTER_ID') self.assertIsNone(res) mock_transport.assert_called_once_with(cfg.CONF) mock_target.assert_called_once_with(topic="versioned_notifications", exchange='FAKE_EXCHANGE') mock_novaendpoint.assert_called_once_with('PROJECT_ID', 'CLUSTER_ID') mock_listener.assert_called_once_with(x_transport, [x_target], [x_endpoint], executor='threading', pool="senlin-listeners") x_listener.start.assert_called_once_with()
def test_listener_proc(self, mock_listener, mock_transport, mock_target, mock_endpoint): x_listener = mock.Mock() mock_listener.return_value = x_listener x_transport = mock.Mock() mock_transport.return_value = x_transport x_target = mock.Mock() mock_target.return_value = x_target x_endpoint = mock.Mock() mock_endpoint.return_value = x_endpoint res = health_manager.ListenerProc('EXCHANGE', 'PROJECT_ID', 'CLUSTER_ID') self.assertIsNone(res) mock_transport.assert_called_once_with(cfg.CONF) mock_target.assert_called_once_with(topic="notifications", exchange='EXCHANGE') mock_endpoint.assert_called_once_with('PROJECT_ID', 'CLUSTER_ID') mock_listener.assert_called_once_with( x_transport, [x_target], [x_endpoint], pool="listener-workers") x_listener.start.assert_called_once_with() x_listener.wait.assert_called_once_with()