mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
add integ tests for defa7ult value
This commit is contained in:
parent
72f1695014
commit
714a4d871c
@ -23,11 +23,11 @@ def started_cluster():
|
|||||||
finally:
|
finally:
|
||||||
cluster.shutdown()
|
cluster.shutdown()
|
||||||
|
|
||||||
|
expected_error = "User can not be created/updated because it exceeds the allowed quantity of authentication methods per user"
|
||||||
|
|
||||||
def test_create(started_cluster):
|
def test_create(started_cluster):
|
||||||
expected_error = "User can not be created/updated because it exceeds the allowed quantity of authentication methods per user"
|
|
||||||
assert expected_error in limited_node.query_and_get_error("CREATE USER u_max_authentication_methods IDENTIFIED BY '1', BY '2', BY '3'")
|
|
||||||
|
|
||||||
|
assert expected_error in limited_node.query_and_get_error("CREATE USER u_max_authentication_methods IDENTIFIED BY '1', BY '2', BY '3'")
|
||||||
|
|
||||||
assert expected_error not in limited_node.query_and_get_answer_with_error("CREATE USER u_max_authentication_methods IDENTIFIED BY '1', BY '2'")
|
assert expected_error not in limited_node.query_and_get_answer_with_error("CREATE USER u_max_authentication_methods IDENTIFIED BY '1', BY '2'")
|
||||||
|
|
||||||
@ -36,10 +36,8 @@ def test_create(started_cluster):
|
|||||||
def test_alter(started_cluster):
|
def test_alter(started_cluster):
|
||||||
limited_node.query("CREATE USER u_max_authentication_methods IDENTIFIED BY '1'")
|
limited_node.query("CREATE USER u_max_authentication_methods IDENTIFIED BY '1'")
|
||||||
|
|
||||||
expected_error = "User can not be created/updated because it exceeds the allowed quantity of authentication methods per user"
|
|
||||||
assert expected_error in limited_node.query_and_get_error("ALTER USER u_max_authentication_methods ADD IDENTIFIED BY '2', BY '3'")
|
assert expected_error in limited_node.query_and_get_error("ALTER USER u_max_authentication_methods ADD IDENTIFIED BY '2', BY '3'")
|
||||||
|
|
||||||
expected_error = "User can not be created/updated because it exceeds the allowed quantity of authentication methods per user"
|
|
||||||
assert expected_error in limited_node.query_and_get_error("ALTER USER u_max_authentication_methods IDENTIFIED BY '3', BY '4', BY '5'")
|
assert expected_error in limited_node.query_and_get_error("ALTER USER u_max_authentication_methods IDENTIFIED BY '3', BY '4', BY '5'")
|
||||||
|
|
||||||
assert expected_error not in limited_node.query_and_get_answer_with_error("ALTER USER u_max_authentication_methods ADD IDENTIFIED BY '2'")
|
assert expected_error not in limited_node.query_and_get_answer_with_error("ALTER USER u_max_authentication_methods ADD IDENTIFIED BY '2'")
|
||||||
@ -47,3 +45,44 @@ def test_alter(started_cluster):
|
|||||||
assert expected_error not in limited_node.query_and_get_answer_with_error("ALTER USER u_max_authentication_methods IDENTIFIED BY '2', BY '3'")
|
assert expected_error not in limited_node.query_and_get_answer_with_error("ALTER USER u_max_authentication_methods IDENTIFIED BY '2', BY '3'")
|
||||||
|
|
||||||
limited_node.query("DROP USER u_max_authentication_methods")
|
limited_node.query("DROP USER u_max_authentication_methods")
|
||||||
|
|
||||||
|
|
||||||
|
def get_query_with_multiple_identified_with(operation, username, identified_with_count, add_operation = ""):
|
||||||
|
identified_clauses = ", ".join([f"BY '1'" for _ in range(identified_with_count)])
|
||||||
|
query = f"{operation} USER {username} {add_operation} IDENTIFIED {identified_clauses}"
|
||||||
|
return query
|
||||||
|
|
||||||
|
|
||||||
|
def test_create_default_setting(started_cluster):
|
||||||
|
expected_error = "User can not be created/updated because it exceeds the allowed quantity of authentication methods per user"
|
||||||
|
|
||||||
|
query_exceeds = get_query_with_multiple_identified_with("CREATE", "u_max_authentication_methods", 257)
|
||||||
|
|
||||||
|
assert expected_error in default_node.query_and_get_error(query_exceeds)
|
||||||
|
|
||||||
|
query_not_exceeds = get_query_with_multiple_identified_with("CREATE", "u_max_authentication_methods", 256)
|
||||||
|
|
||||||
|
assert expected_error not in default_node.query_and_get_answer_with_error(query_not_exceeds)
|
||||||
|
|
||||||
|
default_node.query("DROP USER u_max_authentication_methods")
|
||||||
|
|
||||||
|
def test_alter_default_setting(started_cluster):
|
||||||
|
default_node.query("CREATE USER u_max_authentication_methods IDENTIFIED BY '1'")
|
||||||
|
|
||||||
|
query_add_exceeds = get_query_with_multiple_identified_with("ALTER", "u_max_authentication_methods", 256, "ADD")
|
||||||
|
|
||||||
|
assert expected_error in default_node.query_and_get_error(query_add_exceeds)
|
||||||
|
|
||||||
|
query_replace_exceeds = get_query_with_multiple_identified_with("ALTER", "u_max_authentication_methods", 257)
|
||||||
|
|
||||||
|
assert expected_error in default_node.query_and_get_error(query_replace_exceeds)
|
||||||
|
|
||||||
|
query_add_not_exceeds = get_query_with_multiple_identified_with("ALTER", "u_max_authentication_methods", 1, "ADD")
|
||||||
|
|
||||||
|
assert expected_error not in default_node.query_and_get_answer_with_error(query_add_not_exceeds)
|
||||||
|
|
||||||
|
query_replace_not_exceeds = get_query_with_multiple_identified_with("ALTER", "u_max_authentication_methods", 2)
|
||||||
|
|
||||||
|
assert expected_error not in default_node.query_and_get_answer_with_error(query_replace_not_exceeds)
|
||||||
|
|
||||||
|
default_node.query("DROP USER u_max_authentication_methods")
|
||||||
|
Loading…
Reference in New Issue
Block a user