diff --git a/tests/pytest/tools/taosdemoAllTest/insert-default.json b/tests/pytest/tools/taosdemoAllTest/insert-default.json new file mode 100644 index 0000000000000000000000000000000000000000..423f94819f6302a50835a74e7eb5bb06fbf58c94 --- /dev/null +++ b/tests/pytest/tools/taosdemoAllTest/insert-default.json @@ -0,0 +1,16 @@ +{ + "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}] + }] + }] +} diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py index 0e68e2e88078d3239ceba8d88200e7ea5b1cffe4..b3db10b908ccece39eaba0a35625a35897d520f2 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestInsertWithJson.py @@ -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") diff --git a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py index 3a3152ecde3c4eca09d8b8583cf90bbfdc0cc31d..957e212db9c230d5341266cb983552b490690d4f 100644 --- a/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py +++ b/tests/pytest/tools/taosdemoAllTest/taosdemoTestQueryWithJson.py @@ -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):