From: Yuval Lifshitz Date: Mon, 19 Aug 2024 16:48:29 +0000 (+0000) Subject: test/rgw/notifications: don't check for full queue if topics expired X-Git-Tag: testing/wip-mchangir-testing-20240821.131543-main-debug~3^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=064b524815caece4b886b373c7ac6195a4a58733;p=ceph-ci.git test/rgw/notifications: don't check for full queue if topics expired there are other tests for queue length, so we can skip this check if test takes too long. also remove unnecessary delays from the test. Fixes: https://tracker.ceph.com/issues/67514?tab=history Signed-off-by: Yuval Lifshitz --- diff --git a/src/test/rgw/bucket_notification/test_bn.py b/src/test/rgw/bucket_notification/test_bn.py index 5b18562c664..46909768cc8 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -3204,9 +3204,6 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict): host = get_ip() port = random.randint(10000, 20000) - # start an http server in a separate thread - http_server = HTTPServerWithEvents((host, port)) - # create bucket bucket_name = gen_bucket_name() bucket = conn.create_bucket(bucket_name) @@ -3227,9 +3224,6 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict): response, status = s3_notification_conf.set_config() assert_equal(status/100, 2) - delay = 20 - time.sleep(delay) - http_server.close() # topic get parsed_result = get_topic(topic_name) parsed_result_dest = parsed_result["dest"] @@ -3254,10 +3248,13 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict): print('average time for creation + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds') # topic stats - get_stats_persistent_topic(topic_name, number_of_objects) + if time_diff > persistency_time: + log.warning('persistency time for topic %s already passed. not possible to check object in the queue', topic_name) + else: + get_stats_persistent_topic(topic_name, number_of_objects) + # wait as much as ttl and check if the persistent topics have expired + time.sleep(persistency_time) - # wait as much as ttl and check if the persistent topics have expired - time.sleep(persistency_time) get_stats_persistent_topic(topic_name, 0) # delete objects from the bucket @@ -3269,18 +3266,18 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict): thr = threading.Thread(target = key.delete, args=()) thr.start() client_threads.append(thr) - if count%100 == 0: - [thr.join() for thr in client_threads] - time_diff = time.time() - start_time - print('average time for deletion + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds') - client_threads = [] - start_time = time.time() + [thr.join() for thr in client_threads] + time_diff = time.time() - start_time + print('average time for deletion + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds') # topic stats - get_stats_persistent_topic(topic_name, number_of_objects) + if time_diff > persistency_time: + log.warning('persistency time for topic %s already passed. not possible to check object in the queue', topic_name) + else: + get_stats_persistent_topic(topic_name, number_of_objects) + # wait as much as ttl and check if the persistent topics have expired + time.sleep(persistency_time) - # wait as much as ttl and check if the persistent topics have expired - time.sleep(persistency_time) get_stats_persistent_topic(topic_name, 0) # cleanup @@ -3288,7 +3285,6 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict): topic_conf.del_config() # delete the bucket conn.delete_bucket(bucket_name) - time.sleep(delay) def create_persistency_config_string(config_dict): str_ret = "" @@ -3303,7 +3299,7 @@ def test_ps_s3_persistent_topic_configs_ttl(): """ test persistent topic configurations with time_to_live """ config_dict = {"time_to_live": 30, "max_retries": "None", "retry_sleep_duration": "None"} buffer = 10 - persistency_time =config_dict["time_to_live"] + buffer + persistency_time = config_dict["time_to_live"] + buffer ps_s3_persistent_topic_configs(persistency_time, config_dict)