From 22d63bbc5636fd9d0283f920c9db25ad2edadaa2 Mon Sep 17 00:00:00 2001 From: Jakub Drobena Date: Tue, 13 Feb 2024 13:36:42 +0100 Subject: [PATCH] BDD test added for compression in sha extractro --- features/src/kafka_util.py | 2 +- features/steps/insights_sha_extractor.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/src/kafka_util.py b/features/src/kafka_util.py index f9488e1c..fcbb1dcb 100644 --- a/features/src/kafka_util.py +++ b/features/src/kafka_util.py @@ -85,7 +85,7 @@ def consume_event(bootstrap, topic, group_id=None): consumer.subscribe(topics=topic) return consumer.poll() -def consume_one_message_from_topic(bootsrap, topic): +def consume_message_from_topic(bootsrap, topic): """Consume one messages in given topic.""" consumer = KafkaConsumer( topic, diff --git a/features/steps/insights_sha_extractor.py b/features/steps/insights_sha_extractor.py index 48f6c0d5..5a2e2569 100644 --- a/features/steps/insights_sha_extractor.py +++ b/features/steps/insights_sha_extractor.py @@ -234,7 +234,7 @@ def compressed_archive_sent_to_topic(context): """Check that sha extractor did not process any event.""" decoded = None error= None - message = kafka_util.consume_one_message_from_topic(context.kafka_hostname, context.outgoing_topic) + message = kafka_util.consume_message_from_topic(context.kafka_hostname, context.outgoing_topic) try: decoded = gzip.decompress(message.value) except Exception as err: @@ -249,7 +249,7 @@ def no_compressed_archive_sent_to_topic(context): """Check that sha extractor did not process any event.""" decoded = None error= None - message = kafka_util.consume_one_message_from_topic(context.kafka_hostname, context.outgoing_topic) + message = kafka_util.consume_message_from_topic(context.kafka_hostname, context.outgoing_topic) try: decoded = gzip.decompress(message.value) except Exception as err: