File tree 1 file changed +32
-0
lines changed 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -461,6 +461,38 @@ def create_user_with_jwt_auth(
461
461
node .query (f"DROP USER IF EXISTS { user_name } " )
462
462
463
463
464
+ @TestStep (Given )
465
+ def create_user_with_password_auth (
466
+ self ,
467
+ user_name : str ,
468
+ node : Node = None ,
469
+ password : str = None ,
470
+ cluster : str = None ,
471
+ if_not_exists : bool = False ,
472
+ ):
473
+ """Create a user with JWT authentication."""
474
+ if node is None :
475
+ node = self .context .node
476
+
477
+ if_not_exists = "IF NOT EXISTS" if if_not_exists else ""
478
+
479
+ query = f"CREATE USER { if_not_exists } { user_name } "
480
+
481
+ if cluster is not None :
482
+ query += f"ON CLUSTER { cluster } "
483
+
484
+ if password is not None :
485
+ query += f"IDENTIFIED WITH PLAINTEXT_PASSWORD BY { password } "
486
+
487
+ try :
488
+ node .query (query )
489
+ yield
490
+
491
+ finally :
492
+ with Finally ("drop user" ):
493
+ node .query (f"DROP USER IF EXISTS { user_name } " )
494
+
495
+
464
496
@TestStep (Then )
465
497
def check_clickhouse_client_jwt_login (
466
498
self ,
You can’t perform that action at this time.
0 commit comments