提交 2186d655 编写于 作者: S Shengliang Guan

test: add test case for grant revoke user

上级 4c30b53a
......@@ -238,9 +238,10 @@ TEST_F(MndTestUser, 03_Alter_User) {
{
SAlterUserReq alterReq = {0};
alterReq.alterType = TSDB_ALTER_USER_CLEAR_WRITE_DB;
alterReq.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB;
strcpy(alterReq.user, "u3");
strcpy(alterReq.pass, "1");
strcpy(alterReq.dbname, "*");
int32_t contLen = tSerializeSAlterUserReq(NULL, 0, &alterReq);
void* pReq = rpcMallocCont(contLen);
......@@ -253,9 +254,10 @@ TEST_F(MndTestUser, 03_Alter_User) {
{
SAlterUserReq alterReq = {0};
alterReq.alterType = TSDB_ALTER_USER_CLEAR_READ_DB;
alterReq.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB;
strcpy(alterReq.user, "u3");
strcpy(alterReq.pass, "1");
strcpy(alterReq.dbname, "*");
int32_t contLen = tSerializeSAlterUserReq(NULL, 0, &alterReq);
void* pReq = rpcMallocCont(contLen);
......
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print =============== show users
sql create database d1 vgroups 1;
sql create database d2 vgroups 1;
sql create database d3 vgroups 1;
sql show databases
if $rows != 5 then
return -1
endi
print =============== create users
sql create user user1 PASS 'user1'
sql create user user2 PASS 'user2'
sql show users
if $rows != 3 then
return -1
endi
print =============== test read
sql_error GRANT read ON d1.* to a;
sql_error GRANT read ON d0.* to user1;
sql GRANT read ON d1.* to user1;
sql GRANT read ON d2.* to user1;
sql GRANT read ON *.* to user1;
sql REVOKE read ON d1.* from user1;
sql REVOKE read ON d2.* from user1;
sql REVOKE read ON *.* from user1;
print =============== test write
sql_error GRANT write ON d1.* to a;
sql_error GRANT write ON d0.* to user1;
sql GRANT write ON d1.* to user1;
sql GRANT write ON d2.* to user1;
sql GRANT write ON *.* to user1;
sql REVOKE write ON d1.* from user1;
sql REVOKE write ON d2.* from user1;
sql REVOKE write ON *.* from user1;
print =============== test all
sql_error GRANT all ON d1.* to a;
sql_error GRANT all ON d0.* to user1;
sql GRANT all ON d1.* to user1;
sql GRANT all ON d2.* to user1;
sql GRANT all ON *.* to user1;
sql REVOKE all ON d1.* from user1;
sql REVOKE all ON d2.* from user1;
sql REVOKE all ON *.* from user1;
print =============== test read write
sql_error GRANT read,write ON d1.* to a;
sql_error GRANT read,write ON d0.* to user1;
sql GRANT read,write ON d1.* to user1;
sql GRANT read,write ON d2.* to user1;
sql GRANT read,write ON *.* to user1;
sql REVOKE read,write ON d1.* from user1;
sql REVOKE read,write ON d2.* from user1;
sql REVOKE read,write ON *.* from user1;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册