Skip to content

Commit

Permalink
chore(query): modify rbac test result display (#16686)
Browse files Browse the repository at this point in the history
  • Loading branch information
TCeason authored Oct 24, 2024
1 parent d83bb39 commit 24861ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
-- reset users
-- prepare user and tables for tests
Error: APIError: ResponseError with 1063: Permission denied: privilege [Alter] is required on *.* for user 'testuser1'@'%' with roles [public]. Note: Please ensure that your current role have the appropriate permissions to create a new Database|Table|UDF|Stage.
Error: APIError: ResponseError with 1063: Permission denied: privilege [Alter] is required on *.* for user 'testuser1'@'%' with roles [public]. Note: Please ensure that your current role have the appropriate permissions to create a new Database|Table|UDF|Stage.
Error: APIError: ResponseError with 1063: Permission denied: privilege [Alter] is required on *.* for user 'testuser1'@'%' with roles [public]. Note: Please ensure that your current role have the appropriate permissions to create a new Database|Table|UDF|Stage.
Error: APIError: RequestError: Query Page failed with status 401 Unauthorized: {"error":{"code":5100,"message":"wrong password"}}
Error: APIError: RequestError: Start Query failed with status 401 Unauthorized: {"error":{"code":5100,"message":"wrong password"}}
1
1
1
1
1
testuser1 password is 123
testuser2 password not modify
-- reset users
10 changes: 5 additions & 5 deletions tests/suites/0_stateless/18_rbac/18_0011_alter_own_username.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ echo "DROP USER IF EXISTS 'testuser2'" | $BENDSQL_CLIENT_CONNECT
echo '-- prepare user and tables for tests'
echo "CREATE USER 'testuser1' IDENTIFIED BY '$TEST_USER_PASSWORD'" | $BENDSQL_CLIENT_CONNECT
echo "CREATE USER 'testuser2' IDENTIFIED BY '$TEST_USER_PASSWORD'" | $BENDSQL_CLIENT_CONNECT
echo "alter user 'testuser2' identified by '123'" | $TEST_USER_CONNECT
echo "alter user 'testuser1' identified by '123' with default_role='role1'" | $TEST_USER_CONNECT
echo "alter user 'testuser1' identified by '123' with disabled=true" | $TEST_USER_CONNECT
echo "alter user 'testuser2' identified by '123'" | $TEST_USER_CONNECT 2>&1 | grep 'Permission denied: privilege \[Alter\]' |wc -l
echo "alter user 'testuser1' identified by '123' with default_role='role1'" | $TEST_USER_CONNECT 2>&1 | grep 'Permission denied: privilege \[Alter\]' |wc -l
echo "alter user 'testuser1' identified by '123' with disabled=true" | $TEST_USER_CONNECT 2>&1 | grep 'Permission denied: privilege \[Alter\]' |wc -l

# Note: this query in bendsql will return err, because bendsql will call auth in poll, after password modified, in next poll the auth failed, it will return err.
# testuser1@localhost:8000/default> alter user 'testuser1' identified by '123';
# error: APIError: RequestError: Query Page failed with status 401 Unauthorized: {"error":{"code":"401","message":"wrong password"}}
echo "alter user 'testuser1' identified by '123'" | $TEST_USER_CONNECT
echo "alter user 'testuser1' identified by '123'" | $TEST_USER_CONNECT 2>&1 | grep 'wrong password' | wc -l

export TEST_USER_MODIFY_CONNECT="bendsql --user=testuser1 --password=123 --host=${QUERY_MYSQL_HANDLER_HOST} --port ${QUERY_HTTP_HANDLER_PORT}"

echo "select 1" | $TEST_USER_CONNECT
echo "select 1" | $TEST_USER_CONNECT 2>&1 | grep 'wrong password' | wc -l
echo "select 'testuser1 password is 123'" | $TEST_USER_MODIFY_CONNECT
echo "select 'testuser2 password not modify'" | $TEST_USER2_CONNECT

Expand Down

0 comments on commit 24861ac

Please sign in to comment.