Skip to content

Commit 064b524

Browse files
committed
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 <[email protected]>
1 parent 7d2cf2c commit 064b524

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/test/rgw/bucket_notification/test_bn.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,9 +3204,6 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict):
32043204
host = get_ip()
32053205
port = random.randint(10000, 20000)
32063206

3207-
# start an http server in a separate thread
3208-
http_server = HTTPServerWithEvents((host, port))
3209-
32103207
# create bucket
32113208
bucket_name = gen_bucket_name()
32123209
bucket = conn.create_bucket(bucket_name)
@@ -3227,9 +3224,6 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict):
32273224
response, status = s3_notification_conf.set_config()
32283225
assert_equal(status/100, 2)
32293226

3230-
delay = 20
3231-
time.sleep(delay)
3232-
http_server.close()
32333227
# topic get
32343228
parsed_result = get_topic(topic_name)
32353229
parsed_result_dest = parsed_result["dest"]
@@ -3254,10 +3248,13 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict):
32543248
print('average time for creation + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds')
32553249

32563250
# topic stats
3257-
get_stats_persistent_topic(topic_name, number_of_objects)
3251+
if time_diff > persistency_time:
3252+
log.warning('persistency time for topic %s already passed. not possible to check object in the queue', topic_name)
3253+
else:
3254+
get_stats_persistent_topic(topic_name, number_of_objects)
3255+
# wait as much as ttl and check if the persistent topics have expired
3256+
time.sleep(persistency_time)
32583257

3259-
# wait as much as ttl and check if the persistent topics have expired
3260-
time.sleep(persistency_time)
32613258
get_stats_persistent_topic(topic_name, 0)
32623259

32633260
# delete objects from the bucket
@@ -3269,26 +3266,25 @@ def ps_s3_persistent_topic_configs(persistency_time, config_dict):
32693266
thr = threading.Thread(target = key.delete, args=())
32703267
thr.start()
32713268
client_threads.append(thr)
3272-
if count%100 == 0:
3273-
[thr.join() for thr in client_threads]
3274-
time_diff = time.time() - start_time
3275-
print('average time for deletion + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds')
3276-
client_threads = []
3277-
start_time = time.time()
3269+
[thr.join() for thr in client_threads]
3270+
time_diff = time.time() - start_time
3271+
print('average time for deletion + async http notification is: ' + str(time_diff*1000/number_of_objects) + ' milliseconds')
32783272

32793273
# topic stats
3280-
get_stats_persistent_topic(topic_name, number_of_objects)
3274+
if time_diff > persistency_time:
3275+
log.warning('persistency time for topic %s already passed. not possible to check object in the queue', topic_name)
3276+
else:
3277+
get_stats_persistent_topic(topic_name, number_of_objects)
3278+
# wait as much as ttl and check if the persistent topics have expired
3279+
time.sleep(persistency_time)
32813280

3282-
# wait as much as ttl and check if the persistent topics have expired
3283-
time.sleep(persistency_time)
32843281
get_stats_persistent_topic(topic_name, 0)
32853282

32863283
# cleanup
32873284
s3_notification_conf.del_config()
32883285
topic_conf.del_config()
32893286
# delete the bucket
32903287
conn.delete_bucket(bucket_name)
3291-
time.sleep(delay)
32923288

32933289
def create_persistency_config_string(config_dict):
32943290
str_ret = ""
@@ -3303,7 +3299,7 @@ def test_ps_s3_persistent_topic_configs_ttl():
33033299
""" test persistent topic configurations with time_to_live """
33043300
config_dict = {"time_to_live": 30, "max_retries": "None", "retry_sleep_duration": "None"}
33053301
buffer = 10
3306-
persistency_time =config_dict["time_to_live"] + buffer
3302+
persistency_time = config_dict["time_to_live"] + buffer
33073303

33083304
ps_s3_persistent_topic_configs(persistency_time, config_dict)
33093305

0 commit comments

Comments
 (0)