From 8e2d4811de61eeb9c9cf81f42328c446f0dcfe56 Mon Sep 17 00:00:00 2001 From: slguan Date: Wed, 1 Apr 2020 11:30:46 +0800 Subject: [PATCH] [TD-16] add script for account --- src/client/src/tscSystem.c | 2 +- tests/script/sh/deploy.sh | 4 +- tests/script/unique/account/paras.sim | 111 ++++++++++++++++++++++++++ tests/script/unique/account/usage.sim | 57 +++++++++++++ tests/script/unique/testSuite.sim | 2 + 5 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 tests/script/unique/account/paras.sim create mode 100644 tests/script/unique/account/usage.sim diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 2db2897036..7a585bfa68 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -93,7 +93,7 @@ int32_t tscInitRpc(const char *user, const char *secret) { rpcInit.sessions = tsMaxMgmtConnections; rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.idleTime = 2000; - rpcInit.user = "root"; + rpcInit.user = (char*)user; rpcInit.ckey = "key"; rpcInit.secret = secretEncrypt; diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 6c4ada50fe..d990adaf5f 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -90,9 +90,9 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG echo "publicIp $NODE_IP" >> $TAOS_CFG echo "internalIp $NODE_IP" >> $TAOS_CFG echo "privateIp $NODE_IP" >> $TAOS_CFG -echo "dDebugFlag 199" >> $TAOS_CFG +echo "dDebugFlag 135" >> $TAOS_CFG echo "mDebugFlag 199" >> $TAOS_CFG -echo "sdbDebugFlag 199" >> $TAOS_CFG +echo "sdbDebugFlag 135" >> $TAOS_CFG echo "rpcDebugFlag 135" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG diff --git a/tests/script/unique/account/paras.sim b/tests/script/unique/account/paras.sim new file mode 100644 index 0000000000..14ee2f6c85 --- /dev/null +++ b/tests/script/unique/account/paras.sim @@ -0,0 +1,111 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 +system sh/exec_up.sh -n dnode1 -s start +sql connect + +print =============== show accounts +sql show accounts +if $rows != 1 then + return -1 +endi + +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +if $data00 != root then + return -1 +endi +if $data02 != 3/10 then + return -1 +endi +if $data03 != 0/64 then + return -1 +endi +if $data04 != 0/2147483647 then + return -1 +endi +if $data05 != 0/1000 then + return -1 +endi +if $data06 != 0.000/unlimited then + return -1 +endi + +print =============== create account +sql create account hou pass "hou" tseries 80000 storage 10737418240 streams 10 qtime 3600 dbs 3 users 3 conns 10 +sql show accounts +if $rows != 2 then + return -1 +endi + +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $data10 != hou then + return -1 +endi +if $data12 != 2/3 then + return -1 +endi +if $data13 != 0/3 then + return -1 +endi +if $data14 != 0/80000 then + return -1 +endi +if $data15 != 0/10 then + return -1 +endi +if $data16 != 0.000/10.000 then + return -1 +endi + +print =============== alter account +sql alter account hou pass "hou" tseries 8000 streams 10 dbs 5 users 5 +sql show accounts +if $rows != 2 then + return -1 +endi + +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $data10 != hou then + return -1 +endi +if $data12 != 2/5 then + return -1 +endi +if $data13 != 0/5 then + return -1 +endi +if $data14 != 0/8000 then + return -1 +endi +if $data15 != 0/10 then + return -1 +endi +if $data16 != 0.000/10.000 then + return -1 +endi + +print =============== alter account +sql create account hou pass "hou" tseries 8000 streams 10 dbs 5 users 6 +sql show accounts +if $rows != 2 then + return -1 +endi + +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $data10 != hou then + return -1 +endi +if $data12 != 2/6 then + return -1 +endi +if $data13 != 0/5 then + return -1 +endi +if $data14 != 0/8000 then + return -1 +endi +if $data15 != 0/10 then + return -1 +endi +if $data16 != 0.000/10.000 then + return -1 +endi diff --git a/tests/script/unique/account/usage.sim b/tests/script/unique/account/usage.sim new file mode 100644 index 0000000000..5b334374c9 --- /dev/null +++ b/tests/script/unique/account/usage.sim @@ -0,0 +1,57 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1 +system sh/exec_up.sh -n dnode1 -s start +sql connect + +print =============== show accounts + +print =============== create account +sql alter account root pass "taosdata" tseries 8000 streams 10 dbs 5 users 5 +sql show accounts +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 +if $data00 != root then + return -1 +endi +if $data02 != 3/5 then + return -1 +endi +if $data03 != 0/5 then + return -1 +endi +if $data04 != 0/8000 then + return -1 +endi +if $data05 != 0/10 then + return -1 +endi + +print =============== check usage account +sql create database d1 +sql create database d2 +sql create database d3 +sql create database d4 +sql create database d5 + +sql create table d1.t1 (ts timestamp, i int); +sql create user u1 pass "u1" + +sql show accounts +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $data00 != root then + return -1 +endi +if $data02 != 4/5 then + return -1 +endi +if $data03 != 5/5 then + return -1 +endi +if $data04 != 1/8000 then + return -1 +endi +if $data05 != 0/10 then + return -1 +endi + +print =============== check grant +sql_error create database d6 \ No newline at end of file diff --git a/tests/script/unique/testSuite.sim b/tests/script/unique/testSuite.sim index 1782f3ccd5..f3bb3ebb92 100644 --- a/tests/script/unique/testSuite.sim +++ b/tests/script/unique/testSuite.sim @@ -1,3 +1,5 @@ ################################# run unique/account/basic.sim +run unique/account/paras.sim +run unique/account/usage.sim ################################## -- GitLab