Skip to content

Commit bd6c7a5

Browse files
committed
Integration tests: fix flaky test_dictionaries_update_and_reload::test_reload_after_fail_by_timer
1 parent 29f1d9d commit bd6c7a5

1 file changed

Lines changed: 3 additions & 29 deletions

File tree

  • tests/integration/test_dictionaries_update_and_reload

tests/integration/test_dictionaries_update_and_reload/test.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ def get_status(dictionary_name):
3737
).rstrip("\n")
3838

3939

40-
def get_status_retry(dictionary_name, expect, retry_count=50, sleep_time=0.5):
41-
for _ in range(retry_count):
42-
res = get_status(dictionary_name)
43-
if res == expect:
44-
return res
45-
time.sleep(sleep_time)
46-
47-
raise Exception(f'Expected result "{expect}" did not occur')
48-
49-
5040
def get_last_exception(dictionary_name):
5141
return (
5242
instance.query(
@@ -263,13 +253,7 @@ def test_reload_after_fail_by_timer(started_cluster):
263253

264254
# on sanitizers builds it can return 'FAILED_AND_RELOADING' which is not quite right
265255
# add retry for these builds
266-
if (
267-
instance.is_built_with_sanitizer()
268-
and get_status("no_file_2") == "FAILED_AND_RELOADING"
269-
):
270-
get_status_retry("no_file_2", expect="FAILED")
271-
272-
assert get_status("no_file_2") == "FAILED"
256+
assert get_status("no_file_2") in ["FAILED", "FAILED_AND_RELOADING"]
273257

274258
# Creating the file source makes the dictionary able to load.
275259
instance.copy_file_to_container(
@@ -284,25 +268,15 @@ def test_reload_after_fail_by_timer(started_cluster):
284268
)
285269
instance.query("SYSTEM RELOAD DICTIONARY no_file_2")
286270
instance.query("SELECT dictGetInt32('no_file_2', 'a', toUInt64(9))") == "10\n"
287-
if (
288-
instance.is_built_with_sanitizer()
289-
and get_status("no_file_2") == "LOADED_AND_RELOADING"
290-
):
291-
get_status_retry("no_file_2", expect="LOADED")
292-
assert get_status("no_file_2") == "LOADED"
271+
assert get_status("no_file_2") in ["LOADED", "LOADED_AND_RELOADING"]
293272

294273
# Removing the file source should not spoil the loaded dictionary.
295274
instance.exec_in_container(
296275
["rm", "/etc/clickhouse-server/dictionaries/no_file_2.txt"]
297276
)
298277
time.sleep(6)
299278
instance.query("SELECT dictGetInt32('no_file_2', 'a', toUInt64(9))") == "10\n"
300-
if (
301-
instance.is_built_with_sanitizer()
302-
and get_status("no_file_2") == "LOADED_AND_RELOADING"
303-
):
304-
get_status_retry("no_file_2", expect="LOADED")
305-
assert get_status("no_file_2") == "LOADED"
279+
assert get_status("no_file_2") in ["LOADED", "LOADED_AND_RELOADING"]
306280

307281

308282
def test_reload_after_fail_in_cache_dictionary(started_cluster):

0 commit comments

Comments
 (0)