From 4f2ac201ecad6abbdb7fa0bfd21ed1b86282d218 Mon Sep 17 00:00:00 2001 From: Yuval Lifshitz Date: Thu, 23 Nov 2023 14:29:04 +0000 Subject: [PATCH] rgw/test/kafka: let consumer read events from the beginning in some cases the RGW may publish the notifications before the kafka consumer started reading the events from the topic Fixes: https://tracker.ceph.com/issues/62136 Signed-off-by: Yuval Lifshitz --- src/test/rgw/bucket_notification/test_bn.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/rgw/bucket_notification/test_bn.py b/src/test/rgw/bucket_notification/test_bn.py index 32fe262bdc310..8860df1555ef9 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -434,7 +434,8 @@ class KafkaReceiver(object): self.consumer = KafkaConsumer(topic, bootstrap_servers = kafka_server+':'+str(port), security_protocol=security_type, - consumer_timeout_ms=16000) + consumer_timeout_ms=16000, + auto_offset_reset='earliest') print('Kafka consumer created on topic: '+topic) break except Exception as error: @@ -1534,8 +1535,8 @@ def test_ps_s3_notification_push_kafka_on_master(): time_diff = time.time() - start_time print('average time for creation + kafka notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds') - print('wait for 5sec for the messages...') - time.sleep(5) + print('wait for 10sec for the messages...') + time.sleep(10) keys = list(bucket.list()) receiver.verify_s3_events(keys, exact_match=True, etags=etags) @@ -1551,8 +1552,8 @@ def test_ps_s3_notification_push_kafka_on_master(): time_diff = time.time() - start_time print('average time for deletion + kafka notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds') - print('wait for 5sec for the messages...') - time.sleep(5) + print('wait for 10sec for the messages...') + time.sleep(10) receiver.verify_s3_events(keys, exact_match=True, deletions=True, etags=etags) except Exception as e: assert False, str(e) -- 2.39.5