未验证 提交 197bce2c 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #8347 from taosdata/test/TD-10539-d

Test/td 10539 d
......@@ -391,6 +391,7 @@ python3 ./test.py -f tag_lite/alter_tag.py
python3 test.py -f tools/taosdemoAllTest/TD-4985/query-limit-offset.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insert4096columns_not_use_taosdemo.py
python3 test.py -f tools/taosdemoAllTest/TD-5213/insertSigcolumnsNum4096.py
python3 test.py -f tools/taosdemoAllTest/TD-10539/create_taosdemo.py
python3 ./test.py -f tag_lite/drop_auto_create.py
python3 test.py -f insert/insert_before_use_db.py
python3 test.py -f alter/alter_keep.py
......
###################################################################
# 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
import time
import os
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def run(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
os.system("rm -rf tools/taosdemoAllTest/TD-10539/create_taosdemo.py.sql")
tdSql.prepare()
#print("==============taosdemo,#create stable,table; insert table; show table; select table; drop table")
self.tsdemo = "tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os.system("%staosdemo -d test -E -m %s -t 10 -n 100 -l 10 -y " % (binPath,self.tsdemo))
tdSql.execute("use test ;" )
tdSql.query("select count(*) from meters")
tdSql.checkData(0, 0, 1000)
tdSql.query("show test.tables like 'tsdemo%'" )
tdSql.checkRows(10)
tdSql.query("show test.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(10)
tdSql.query("select _block_dist() from `%s1`" %self.tsdemo)
tdSql.checkRows(1)
tdSql.query("describe test.`%s1` ; " %self.tsdemo)
tdSql.checkRows(13)
tdSql.query("show create table test.`%s1` ; " %self.tsdemo)
tdSql.checkData(0, 0, self.tsdemo+str(1))
tdSql.checkData(0, 1, "CREATE TABLE `%s1` USING `meters` TAGS (1,\"beijing\")" %self.tsdemo)
print("==============drop table\stable")
try:
tdSql.execute("drop table test.`%s1` ; " %self.tsdemo)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from test.`%s1` ; " %self.tsdemo)
tdSql.query("show test.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(9)
try:
tdSql.execute("drop table test.meters ")
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from test.meters ")
tdSql.error("select * from test.`%s2` ; " %self.tsdemo)
# Exception
os.system("%staosdemo -d test -m %s -t 10 -n 100 -l 10 -y " % (binPath,self.tsdemo))
tdSql.query("show test.tables ")
tdSql.checkRows(0)
#print("==============taosdemo,#create regular table; insert table; show table; select table; drop table")
self.tsdemo = "tsdemo~!.@#$%^*[]-_=+{,?.}"
#this escape character is not support in shell . include & () <> | /
os.system("%staosdemo -N -E -m %s -t 10 -n 100 -l 10 -y " % (binPath,self.tsdemo))
tdSql.execute("use test ;" )
tdSql.query("select count(*) from `%s1`" %self.tsdemo)
tdSql.checkData(0, 0, 100)
tdSql.query("show test.tables like 'tsdemo%'" )
tdSql.checkRows(10)
tdSql.query("show test.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(10)
tdSql.query("select _block_dist() from `%s1`" %self.tsdemo)
tdSql.checkRows(1)
tdSql.query("describe test.`%s1` ; " %self.tsdemo)
tdSql.checkRows(11)
tdSql.query("show create table test.`%s1` ; " %self.tsdemo)
tdSql.checkData(0, 0, self.tsdemo+str(1))
tdSql.checkData(0, 1, "create table `%s1` (ts TIMESTAMP,c0 FLOAT,c1 INT,c2 INT,c3 INT,c4 INT,c5 INT,c6 INT,c7 INT,c8 INT,c9 INT)" %self.tsdemo)
print("==============drop table\stable")
try:
tdSql.execute("drop table test.`%s1` ; " %self.tsdemo)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from test.`%s1` ; " %self.tsdemo)
tdSql.query("show test.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(9)
# Exception
os.system("%staosdemo -N -m %s -t 10 -n 100 -l 10 -y " % (binPath,self.tsdemo))
tdSql.query("show test.tables ")
tdSql.checkRows(0)
#print("==============taosdemo——json_yes,#create stable,table; insert table; show table; select table; drop table")
os.system("%staosdemo -f tools/taosdemoAllTest/TD-10539/create_taosdemo_yes.json -y " % binPath)
tdSql.execute("use dbyes")
self.tsdemo_stable = "tsdemo_stable~!.@#$%^*[]-_=+{,?.}"
self.tsdemo = "tsdemo~!.@#$%^*[]-_=+{,?.}"
tdSql.query("select count(*) from dbyes.`%s`" %self.tsdemo_stable)
tdSql.checkData(0, 0, 1000)
tdSql.query("show dbyes.tables like 'tsdemo%'" )
tdSql.checkRows(10)
tdSql.query("show dbyes.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(10)
tdSql.query("select _block_dist() from `%s1`" %self.tsdemo)
tdSql.checkRows(1)
tdSql.query("describe dbyes.`%s1` ; " %self.tsdemo)
tdSql.checkRows(13)
tdSql.query("show create table dbyes.`%s1` ; " %self.tsdemo)
tdSql.checkData(0, 0, self.tsdemo+str(1))
tdSql.checkData(0, 1, "CREATE TABLE `%s1` USING `%s` TAGS (1,1)" %(self.tsdemo,self.tsdemo_stable))
print("==============drop table\stable")
try:
tdSql.execute("drop table dbyes.`%s1` ; " %self.tsdemo)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from dbyes.`%s1` ; " %self.tsdemo)
tdSql.query("show dbyes.tables like '%s_'" %self.tsdemo)
tdSql.checkRows(9)
try:
tdSql.execute("drop table dbyes.`%s` ; " %self.tsdemo_stable)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from dbyes.`%s` ; " %self.tsdemo_stable)
tdSql.error("select * from dbyes.`%s2` ; " %self.tsdemo)
#print("==============taosdemo——json_no,#create stable,table; insert table; show table; select table; drop table")
assert os.system("%staosdemo -f tools/taosdemoAllTest/TD-10539/create_taosdemo_no.json -y " % binPath) == 0
tdSql.query("show dbno.tables ")
tdSql.checkRows(0)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 10,
"thread_count_create_tbl": 10,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 10,
"num_of_records_per_req": 1,
"max_sql_len": 1024000,
"databases": [{
"dbinfo": {
"name": "dbno",
"drop": "yes",
"replica": 1,
"days": 10,
"cache": 50,
"blocks": 8,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "meters",
"child_table_exists":"no",
"childtable_count": 10,
"childtable_prefix": "tsdemo~!.@#$%^*[]-_=+{,?.}",
"escape_character": "no",
"auto_create_table": "no",
"batch_create_tbl_num": 1,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 100,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "",
"tags_file": "",
"columns": [{"type": "INT","count":9}, {"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "INT", "count":2}]
}]
}]
}
{
"filetype": "insert",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"thread_count": 5,
"thread_count_create_tbl": 10,
"result_file": "./insert_res.txt",
"confirm_parameter_prompt": "no",
"insert_interval": 0,
"interlace_rows": 10,
"num_of_records_per_req": 1,
"max_sql_len": 1024000,
"databases": [{
"dbinfo": {
"name": "dbyes",
"drop": "yes",
"replica": 1,
"days": 10,
"cache": 50,
"blocks": 8,
"precision": "ms",
"keep": 36500,
"minRows": 100,
"maxRows": 4096,
"comp":2,
"walLevel":1,
"cachelast":0,
"quorum":1,
"fsync":3000,
"update": 0
},
"super_tables": [{
"name": "tsdemo_stable~!.@#$%^*[]-_=+{,?.}",
"child_table_exists":"no",
"childtable_count": 10,
"childtable_prefix": "tsdemo~!.@#$%^*[]-_=+{,?.}",
"escape_character": "yes",
"auto_create_table": "no",
"batch_create_tbl_num": 1,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 100,
"childtable_limit": 0,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
"interlace_rows": 0,
"insert_interval":0,
"max_sql_len": 1024000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "",
"tags_file": "",
"columns": [{"type": "INT","count":9}, {"type": "BINARY", "len": 16, "count":1}],
"tags": [{"type": "INT", "count":2}]
}]
}]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册