mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix flaky test test_login_as_dropped_user_xml.
This commit is contained in:
parent
988569bdb1
commit
a3cd9dc923
@ -81,18 +81,23 @@ EOF""",
|
||||
["bash", "-c", "rm /etc/clickhouse-server/users.d/user_c.xml"]
|
||||
)
|
||||
|
||||
expected_error = "no user with such name"
|
||||
expected_errors = ["no user with such name", "not found in user directories"]
|
||||
while True:
|
||||
out, err = instance.query_and_get_answer_with_error("SELECT 1", user="C")
|
||||
if expected_error in err:
|
||||
logging.debug(f"Got error '{expected_error}' just as expected")
|
||||
found_error = [
|
||||
expected_error
|
||||
for expected_error in expected_errors
|
||||
if (expected_error in err)
|
||||
]
|
||||
if found_error:
|
||||
logging.debug(f"Got error '{found_error}' just as expected")
|
||||
break
|
||||
if out == "1\n":
|
||||
logging.debug(f"Got output '1', retrying...")
|
||||
time.sleep(0.5)
|
||||
continue
|
||||
raise Exception(
|
||||
f"Expected either output '1' or error '{expected_error}', got output={out} and error={err}"
|
||||
f"Expected either output '1' or one of errors '{expected_errors}', got output={out} and error={err}"
|
||||
)
|
||||
|
||||
assert instance.query("SELECT name FROM system.users WHERE name='C'") == ""
|
||||
|
Loading…
Reference in New Issue
Block a user