From 0345991742133dcb2218745a649344544657cc82 Mon Sep 17 00:00:00 2001 From: tomchon Date: Fri, 17 Dec 2021 18:31:28 +0800 Subject: [PATCH] [TD-11094]:modify taosdemo commandLine test case-uses all interface and data type --- .../taosdemoTestInsertShell.py | 270 ++++++++++-------- 1 file changed, 157 insertions(+), 113 deletions(-) diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py index f35a8030f4..154304193c 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertShell.py @@ -54,121 +54,165 @@ class TDTestCase: tdLog.info("taosd found in %s" % buildPath) binPath = buildPath+ "/build/bin/" - tdLog.info("create super table") - # create super table - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("describe meters;") - tdSql.checkRows(13) - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) + # tdLog.info("create super table") + # # create super table + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("describe meters;") + # tdSql.checkRows(13) + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) - tdLog.info("create general table -N ") - tdSql.execute("drop database db1;") - # create general table -N - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("describe `test.0`;") - tdSql.checkRows(11) - tdSql.error("select count(*) from meters") - tdSql.error("select count(tbname) from meters") - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("use diffrent interface stmt") - tdSql.execute("drop database db1;") - # use diffrent interface-stmt - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("use diffrent interface rest") - tdSql.execute("drop database db1;") - # use diffrent interface -rest - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("use diffrent interface sml") - tdSql.execute("drop database db1;") - # use diffrent interface-sml - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - - tdLog.info("all data type") - tdSql.execute("drop database db1;") - # all data type - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ - -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("all data type and interlace rows") - tdSql.execute("drop database db1;") - # all data type - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ - -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) - tdSql.execute("use db3") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("all data type and too much para") - tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ - localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) - tdSql.execute("drop database db3;") - # repeate parameters - os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ - -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ - localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) - tdSql.execute("use db1") - tdSql.query("select count(*) from meters") - tdSql.checkData(0, 0, 1000) - tdSql.query("select count(tbname) from meters") - tdSql.checkData(0, 0, 10) - tdSql.query("select count(*) from `test.0`") - tdSql.checkData(0, 0, 100) - - tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath)) - # taosdemo error-exceeds max length - assert os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ - -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath)) != 0 + # tdLog.info("create general table -N ") + # tdSql.execute("drop database db1;") + # # create general table -N + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -N " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("describe `test.0`;") + # tdSql.checkRows(11) + # tdSql.error("select count(*) from meters") + # tdSql.error("select count(tbname) from meters") + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # tdLog.info("use diffrent interface stmt") + # tdSql.execute("drop database db1;") + # # use diffrent interface-stmt + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,BINARY\(4000\) -w 40 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # tdLog.info("use diffrent interface rest") + # tdSql.execute("drop database db1;") + # # use diffrent interface -rest + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4097 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # tdLog.info("use diffrent interface sml") + # tdSql.execute("drop database db1;") + # # use diffrent interface-sml + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 1024 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + + # tdLog.info("all data type") + # tdSql.execute("drop database db1;") + # # all data type-taosc + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + # -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + # tdLog.info("all data type") + # tdSql.execute("drop database db1;") + # # all data type-stmt + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + # -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # # all data type-rest + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + # -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I rest " % (binPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # # # all data type-rest + # # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 \ + # # -b INT,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096 \ + # # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I sml " % (binPath,cfgPath)) + # # tdSql.execute("use db1") + # # tdSql.query("select count(*) from meters") + # # tdSql.checkData(0, 0, 1000) + # # tdSql.query("select count(tbname) from meters") + # # tdSql.checkData(0, 0, 10) + # # # tdSql.query("select count(*) from `test.0`") + # # # tdSql.checkData(0, 0, 100) + + # tdLog.info("all data type and interlace rows") + # tdSql.execute("drop database db1;") + # # all data type + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db3 -a 1 -l 10\ + # -b INT,TIMESTAMP,BIGINT,FLOAT,DOUBLE,SMALLINT,TINYINT,BOOL,UINT,UBIGINT,UTINYINT,USMALLINT,BINARY\(15\),NCHAR\(15\) -w 4096\ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -B 1000 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath)) + # tdSql.execute("use db3") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # tdLog.info("all data type and too much para") + # tdLog.info("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + # localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + # tdSql.execute("drop database db3;") + # # repeate parameters + # os.system("%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(15\) -w 4096 \ + # -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test.taosdemo -u root -c %s -h \ + # localhost -P 6030 -d db1 -a 1 -l 100 -b float,int,NCHAR\(15\) -w 4096 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. " % (binPath,cfgPath,cfgPath)) + # tdSql.execute("use db1") + # tdSql.query("select count(*) from meters") + # tdSql.checkData(0, 0, 1000) + # tdSql.query("select count(tbname) from meters") + # tdSql.checkData(0, 0, 10) + # tdSql.query("select count(*) from `test.0`") + # tdSql.checkData(0, 0, 100) + + # taosdemo error + # too max length + sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -d db1 -a 1 -l 10 -b float,int,NCHAR\(4096\) \ + -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I taosc" % (binPath,cfgPath) + tdLog.info("%s" % sql ) + assert os.system("%s" % sql ) != 0 + + # error password + sql = "%staosBenchmark -u root -c %s -h localhost -P 6030 -p123 -d db1 -a 1 -l 10 -b float,int,NCHAR\(40\) \ + -w 40 -T 8 -i 10 -S 1000 -r 1000000 -t 10 -n 100 -M -x -y -O 10 -R 100 -E -m test. -I stmt" % (binPath,cfgPath) + tdLog.info("%s" % sql ) + assert os.system("%s" % sql ) != 0 testcaseFilename = os.path.split(__file__)[-1] os.system("rm -rf ./insert_res*.txt*") -- GitLab