mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
add cleanup code to existing tests so flaky tests pass..
This commit is contained in:
parent
a22f9fd91f
commit
15a67f10dc
@ -18,6 +18,8 @@ def started_cluster():
|
||||
|
||||
|
||||
def test_enabling_access_management():
|
||||
instance.query("DROP USER IF EXISTS Alex")
|
||||
|
||||
instance.query("CREATE USER Alex", user="default")
|
||||
assert (
|
||||
instance.query("SHOW CREATE USER Alex", user="default")
|
||||
@ -37,3 +39,5 @@ def test_enabling_access_management():
|
||||
assert "Not enough privileges" in instance.query_and_get_error(
|
||||
"CREATE USER Robin", user="xyz"
|
||||
)
|
||||
|
||||
instance.query("DROP USER IF EXISTS Alex")
|
||||
|
@ -36,8 +36,8 @@ def cleanup_after_test():
|
||||
yield
|
||||
finally:
|
||||
instance.query("DROP USER IF EXISTS A, B, C")
|
||||
instance.query("DROP TABLE IF EXISTS test.view_1")
|
||||
|
||||
instance.query("DROP TABLE IF EXISTS test.view_1, test.view_2, default.table")
|
||||
|
||||
def test_smoke():
|
||||
instance.query("CREATE USER A")
|
||||
|
@ -297,6 +297,8 @@ def test_https_non_ssl_auth():
|
||||
|
||||
|
||||
def test_create_user():
|
||||
instance.query("DROP USER IF EXISTS emma")
|
||||
|
||||
instance.query("CREATE USER emma IDENTIFIED WITH ssl_certificate CN 'client3'")
|
||||
assert (
|
||||
execute_query_https("SELECT currentUser()", user="emma", cert_name="client3")
|
||||
@ -334,8 +336,12 @@ def test_create_user():
|
||||
'lucy\t[\'ssl_certificate\']\t[\'{"common_names":["client2","client3"]}\']\n'
|
||||
)
|
||||
|
||||
instance.query("DROP USER IF EXISTS emma")
|
||||
|
||||
|
||||
def test_x509_san_support():
|
||||
instance.query("DROP USER IF EXISTS jemma")
|
||||
|
||||
assert (
|
||||
execute_query_native(
|
||||
instance, "SELECT currentUser()", user="jerome", cert_name="client4"
|
||||
@ -369,3 +375,5 @@ def test_x509_san_support():
|
||||
instance.query("SHOW CREATE USER jemma")
|
||||
== "CREATE USER jemma IDENTIFIED WITH ssl_certificate SAN \\'URI:spiffe://foo.com/bar\\', \\'URI:spiffe://foo.com/baz\\'\n"
|
||||
)
|
||||
|
||||
instance.query("DROP USER IF EXISTS jemma")
|
||||
|
@ -186,6 +186,8 @@ def test_https_non_ssl_auth():
|
||||
|
||||
|
||||
def test_create_user():
|
||||
instance.query("DROP USER IF EXISTS emma")
|
||||
|
||||
instance.query("CREATE USER emma IDENTIFIED WITH ssl_certificate CN 'client3'")
|
||||
assert (
|
||||
execute_query_https("SELECT currentUser()", user="emma", cert_name="client3")
|
||||
@ -222,3 +224,5 @@ def test_create_user():
|
||||
== "emma\t['ssl_certificate']\t['{\"common_names\":[\"client2\"]}']\n"
|
||||
'lucy\t[\'ssl_certificate\']\t[\'{"common_names":["client2","client3"]}\']\n'
|
||||
)
|
||||
|
||||
instance.query("DROP USER IF EXISTS emma")
|
||||
|
@ -19,6 +19,8 @@ def started_cluster():
|
||||
|
||||
|
||||
def test_basic(started_cluster):
|
||||
node.query("DROP USER IF EXISTS user_basic")
|
||||
|
||||
# 1. Without VALID UNTIL
|
||||
node.query("CREATE USER user_basic")
|
||||
|
||||
@ -71,8 +73,12 @@ def test_basic(started_cluster):
|
||||
error = "Authentication failed"
|
||||
assert error in node.query_and_get_error("SELECT 1", user="user_basic")
|
||||
|
||||
node.query("DROP USER IF EXISTS user_basic")
|
||||
|
||||
|
||||
def test_details(started_cluster):
|
||||
node.query("DROP USER IF EXISTS user_details_infinity, user_details_time_only")
|
||||
|
||||
# 1. Does not do anything
|
||||
node.query("CREATE USER user_details_infinity VALID UNTIL 'infinity'")
|
||||
|
||||
@ -93,8 +99,12 @@ def test_details(started_cluster):
|
||||
== f"CREATE USER user_details_time_only IDENTIFIED WITH no_password VALID UNTIL \\'{until_year}-01-01 22:03:40\\'\n"
|
||||
)
|
||||
|
||||
node.query("DROP USER IF EXISTS user_details_infinity, user_details_time_only")
|
||||
|
||||
|
||||
def test_restart(started_cluster):
|
||||
node.query("DROP USER IF EXISTS user_restart")
|
||||
|
||||
node.query("CREATE USER user_restart VALID UNTIL '06/11/2010 08:03:20 Z+3'")
|
||||
|
||||
assert (
|
||||
@ -111,3 +121,5 @@ def test_restart(started_cluster):
|
||||
|
||||
error = "Authentication failed"
|
||||
assert error in node.query_and_get_error("SELECT 1", user="user_restart")
|
||||
|
||||
node.query("DROP USER IF EXISTS user_restart")
|
||||
|
Loading…
Reference in New Issue
Block a user