Example #1
0
 def __init__(self):
     super(DecisionEngineManager, self).__init__(
         CONF.watcher_decision_engine.publisher_id,
         CONF.watcher_decision_engine.conductor_topic,
         CONF.watcher_decision_engine.status_topic,
         api_version=self.API_VERSION)
     endpoint = audit_endpoint.AuditEndpoint(
         self,
         max_workers=CONF.watcher_decision_engine.max_workers)
     self.conductor_topic_handler.add_endpoint(endpoint)
Example #2
0
    def test_do_trigger_audit(self, mock_collector):
        mock_collector.return_value = faker_cluster_state.FakerModelCollector()

        audit_handler = oneshot_handler.OneShotAuditHandler(mock.MagicMock())
        endpoint = audit_endpoint.AuditEndpoint(audit_handler)

        with mock.patch.object(oneshot_handler.OneShotAuditHandler,
                               'execute') as mock_call:
            mock_call.return_value = 0
            endpoint.do_trigger_audit(self.context, self.audit.uuid)

        self.assertEqual(mock_call.call_count, 1)
Example #3
0
    def test_trigger_audit(self, mock_collector, mock_handler):
        mock_collector.return_value = faker_cluster_state.FakerModelCollector()

        audit_handler = oneshot_handler.OneShotAuditHandler
        endpoint = audit_endpoint.AuditEndpoint(audit_handler)

        with mock.patch.object(endpoint.executor, 'submit') as mock_call:
            mock_execute = mock.call(endpoint.do_trigger_audit, self.context,
                                     self.audit.uuid)
            endpoint.trigger_audit(self.context, self.audit.uuid)

        mock_call.assert_has_calls([mock_execute])
        self.assertEqual(mock_call.call_count, 1)