Exemple #1
0
 def test_kafka_connection_metrics_listen_for_messages(
         self, mock_start, mock_sleep):
     """Test check_kafka_connection increments kafka connection errors on KafkaError."""
     connection_errors_before = WORKER_REGISTRY.get_sample_value(
         "kafka_connection_errors_total")
     utils.is_kafka_connected(TEST_HOST, TEST_PORT)
     connection_errors_after = WORKER_REGISTRY.get_sample_value(
         "kafka_connection_errors_total")
     self.assertEqual(connection_errors_after - connection_errors_before, 1)
Exemple #2
0
def koku_listener_thread():  # pragma: no cover
    """
    Configure Listener listener thread.

    Returns:
        None

    """
    if is_kafka_connected(Config.INSIGHTS_KAFKA_HOST, Config.INSIGHTS_KAFKA_PORT):  # Check that Kafka is running
        LOG.info("Kafka is running.")

    try:
        listen_for_messages_loop()
    except KeyboardInterrupt:
        exit(0)