Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(query): modify rbac test result display #16686

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading