From 14778e6c7558048a73008bc249c23926c37bd94c Mon Sep 17 00:00:00 2001 From: chang Date: Mon, 11 May 2020 14:00:14 +0800 Subject: [PATCH 1/6] feat: add connection test case --- .../script/general/connection/connection.sim | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/script/general/connection/connection.sim diff --git a/tests/script/general/connection/connection.sim b/tests/script/general/connection/connection.sim new file mode 100644 index 0000000000..71db20b285 --- /dev/null +++ b/tests/script/general/connection/connection.sim @@ -0,0 +1,21 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c wallevel -v 0 +system sh/exec.sh -n dnode1 -s start +sleep 3000 +sql connect + +print ============= step1 +sql close +print close1 +sql connect + +print ============= step2 +sql close +sql connect + +print ============= step3 +sql close +sql connect write + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From e575daa5cf89eea9918f4459d3d653dc309109fd Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 15:33:18 +0800 Subject: [PATCH 2/6] test: add connection test --- tests/script/basicSuite.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index 676ac93bf2..e32f3f5bf6 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -22,4 +22,5 @@ run general/table/vgroup.sim run general/user/basic1.sim run general/user/user_len.sim run general/vector/single.sim +run general/connection/connection.sim ################################## From f799232f2574aeeb1f61697bc1070e8b9303a09a Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 16:54:50 +0800 Subject: [PATCH 3/6] test: add user/authority --- tests/script/general/user/authority.sim | 72 +++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/script/general/user/authority.sim diff --git a/tests/script/general/user/authority.sim b/tests/script/general/user/authority.sim new file mode 100644 index 0000000000..06f0467626 --- /dev/null +++ b/tests/script/general/user/authority.sim @@ -0,0 +1,72 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect +sleep 3000 + +print ============= step1 +sql create user read pass 'taosdata' +sql create user write pass 'taosdata' +sql show users +if $rows != 5 then + return -1 +endi + +print ============= step2 +sql close +sql connect read +sleep 2000 + +sql create database dread +sql show databases +if $rows != 1 then + return -1 +endi + +print ============= step3 +sql close +sql connect write +sleep 2000 + +sql create database dwrite +sql show databases +if $rows != 1 then + return -1 +endi + +print ============ step4 +sql close +sql connect +sleep 2000 + +sql show databases +if $row != 2 then + return -1 +endi + +print ============ step5 +sql close +sql connect read +sleep 2000 + +sql drop database dread +sql drop database dwrite -x step51 + +step51: + +sql close +sql connect +sql show databases +if $rows != 1 then + return -1 +endi + +sql close +sql connect +sleep 2000 +sql drop database d1 +sql drop database d2 +sql drop database d3 +sql drop database d4 + +system sh/exec_up.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file From 706828a1d4d2562b98f0e3c35bcfc1b6fe2b9794 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Mon, 11 May 2020 16:57:53 +0800 Subject: [PATCH 4/6] test: add user/authority --- tests/script/basicSuite.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/basicSuite.sim b/tests/script/basicSuite.sim index e32f3f5bf6..c8b21c6856 100644 --- a/tests/script/basicSuite.sim +++ b/tests/script/basicSuite.sim @@ -23,4 +23,5 @@ run general/user/basic1.sim run general/user/user_len.sim run general/vector/single.sim run general/connection/connection.sim +run general/user/authority.sim ################################## From 6d7b5f28225f8b2515ae9fbc34e566ac3da6e701 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Tue, 12 May 2020 14:41:33 +0800 Subject: [PATCH 5/6] test: fix delete_reuse --- tests/script/general/db/delete_reuse2.sim | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/script/general/db/delete_reuse2.sim b/tests/script/general/db/delete_reuse2.sim index 0117d87104..73a9dae442 100644 --- a/tests/script/general/db/delete_reuse2.sim +++ b/tests/script/general/db/delete_reuse2.sim @@ -29,6 +29,7 @@ print ========= start dnodes system sh/exec.sh -n dnode1 -s start sleep 3000 sql connect +sql reset query cache print ======== step1 sql create database d1 replica 1 From 294b42661f49cd550906ade13d44d3bb3ad92511 Mon Sep 17 00:00:00 2001 From: changshuaiqiang Date: Tue, 12 May 2020 15:30:47 +0800 Subject: [PATCH 6/6] test: add del stable case --- tests/pytest/fulltest.sh | 5 +++- tests/pytest/table/del_stable.py | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/pytest/table/del_stable.py diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 6aec67f9ce..e37dc6748a 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -84,4 +84,7 @@ python3 ./test.py $1 -f import_merge/importTRestart.py # user python3 ./test.py $1 -f user/user_create.py -python3 ./test.py $1 -f user/pass_len.py \ No newline at end of file +python3 ./test.py $1 -f user/pass_len.py + +# table +#python3 ./test.py $1 -f table/del_stable.py \ No newline at end of file diff --git a/tests/pytest/table/del_stable.py b/tests/pytest/table/del_stable.py new file mode 100644 index 0000000000..c81d598638 --- /dev/null +++ b/tests/pytest/table/del_stable.py @@ -0,0 +1,50 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + tdSql.prepare() + + tdSql.execute("drop database if exists db") + print("==============step1") + tdSql.execute("create database db") + tdSql.execute("create table db.st (ts timestamp, i int) tags(j int)") + tdSql.execute("create table db.tb using st tags(1)") + tdSql.execute("insert into db.tb values(now, 1)") + + print("==============step2") + try: + tdSql.execute("drop table db.st") + except Exception as e: + tdLog.exit(e) + tdSql.execute("select * from db.st") + tdSql.checkRows(1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase())