Exemple #1
0
 def test_get_watermark_for_topic(self, kafka_client_mock):
     with mock.patch(
             'kafka_utils.util.monitoring.'
             'get_topics_watermarks',
             return_value={'test_topic': [1, 99]},
             autospec=True,
     ):
         result = get_watermark_for_topic(kafka_client_mock, 'test_topic')
         assert result['test_topic'][1] == 99
 def get_watermarks(cls, client, topic, exact=False):
     try:
         if not exact:
             return get_watermark_for_regex(client, topic)
         else:
             return get_watermark_for_topic(client, topic)
     except (UnknownPartitions, UnknownTopic, FailedPayloadsError) as e:
         print(
             "Error: Encountered error with Kafka, please try again later: ",
             e.message)
         raise
Exemple #3
0
 def test_get_watermark_for_topic(self, kafka_client_mock):
     with mock.patch(
             'kafka_utils.util.monitoring.'
             'get_topics_watermarks',
             return_value={'test_topic': [1, 99]},
             autospec=True,
     ):
         result = get_watermark_for_topic(
             kafka_client_mock,
             'test_topic')
         assert result['test_topic'][1] == 99