提交 38684edd 编写于 作者: haoranc's avatar haoranc

[TD-11094]<test>:update insert and query testcase of taosdemo

上级 b55d0864
{
"filetype": "insert",
"databases": [{
"dbinfo": {
"name": "db"
},
"super_tables": [{
"name": "stb0",
"childtable_count": 100,
"childtable_prefix": "stb00_",
"insert_rows": 123,
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":1}, {"type": "BINARY", "len": 32, "count":1}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY", "len": 16, "count":1}]
}]
}]
}
......@@ -80,7 +80,17 @@ class TDTestCase:
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 200)
# default values json files
tdSql.execute("drop database if exists db")
os.system("%staosdemo -f tools/taosdemoAllTest/insert-default.json -y " % binPath)
tdSql.query("show databases;")
for i in range(tdSql.queryRows):
if tdSql.queryResult[i][0] == 'db':
tdSql.checkData(i, 2, 100)
tdSql.checkData(i, 4, 1)
tdSql.checkData(i, 6, 10)
tdSql.checkData(i, 16, 'ms')
# insert: create mutiple tables per sql and insert one rows per sql .
os.system("%staosdemo -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
tdSql.execute("use db")
......
......@@ -52,8 +52,8 @@ class TDTestCase:
self.expectResult = expectResult
with open("%s" % filename, 'r+') as f1:
for line in f1.readlines():
queryResult = line.strip().split()[0]
self.assertCheck(filename, queryResult, expectResult)
queryResultTaosc = line.strip().split()[0]
self.assertCheck(filename, queryResultTaosc, expectResult)
# 获取restful接口查询的结果文件中的关键内容,目前的关键内容找到第一个key就跳出循,所以就只有一个数据。后续再修改多个结果文件。
def getfileDataRestful(self, filename):
......@@ -65,9 +65,12 @@ class TDTestCase:
pattern = re.compile("{.*}")
contents = pattern.search(contents).group()
contentsDict = ast.literal_eval(contents) # 字符串转换为字典
queryResult = contentsDict['data'][0][0]
queryResultRest = contentsDict['data'][0][0]
break
return queryResult
else :
queryResultRest = ""
return queryResultRest
# 获取taosc接口查询次数
def queryTimesTaosc(self, filename):
......@@ -185,9 +188,10 @@ class TDTestCase:
os.system(
"%staosdemo -f tools/taosdemoAllTest/queryInsertdata.json" %
binPath)
os.system(
exceptcode = os.system(
"%staosdemo -f tools/taosdemoAllTest/queryQps.json" %
binPath)
assert exceptcode == 0
# use illegal or out of range parameters query json file
os.system(
......@@ -228,7 +232,7 @@ class TDTestCase:
os.system("rm -rf tools/taosdemoAllTest/*.py.sql")
os.system("rm -rf ./querySystemInfo*")
os.system("rm -rf ./query_res*")
# os.system("rm -rf ./all_query*")
# os.system("rm -rf ./all_query*")
os.system("rm -rf ./test_query_res0.txt")
def stop(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册