From: Yuval Lifshitz Date: Tue, 9 Apr 2024 10:00:08 +0000 (+0000) Subject: test/rgw/notification: fix threading issue in test X-Git-Tag: testing/wip-batrick-testing-20240411.154038~14^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=51e365927361db19b2ae2b270bab7f30fe3e51ee;p=ceph-ci.git test/rgw/notification: fix threading issue in test test_ps_s3_persistent_topic_stats may delete boto client threads before they are done. also, no need to run the http server twice Fixes: https://tracker.ceph.com/issues/63909 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 5345143b8b7..25770487cca 100644 --- a/src/test/rgw/bucket_notification/test_bn.py +++ b/src/test/rgw/bucket_notification/test_bn.py @@ -3094,9 +3094,6 @@ def test_ps_s3_persistent_topic_stats(): 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) @@ -3117,10 +3114,6 @@ def test_ps_s3_persistent_topic_stats(): response, status = s3_notification_conf.set_config() assert_equal(status/100, 2) - delay = 30 - time.sleep(delay) - http_server.close() - # topic stats result = admin(['topic', 'stats', '--topic', topic_name], get_config_cluster()) parsed_result = json.loads(result[0]) @@ -3150,18 +3143,13 @@ def test_ps_s3_persistent_topic_stats(): # delete objects from the bucket client_threads = [] start_time = time.time() - count = 0 for key in bucket.list(): - count += 1 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 result = admin(['topic', 'stats', '--topic', topic_name], get_config_cluster()) @@ -3179,7 +3167,6 @@ def test_ps_s3_persistent_topic_stats(): topic_conf.del_config() # delete the bucket conn.delete_bucket(bucket_name) - time.sleep(delay) http_server.close() def ps_s3_persistent_topic_configs(persistency_time, config_dict):