未验证 提交 4478a61b 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #9259 from taosdata/dev/chr

[TD-11094][TD-6677][TD-10789][TD-12389]<test>:add taosdemo shell test case
###################################################################
# 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, db_test.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 os
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
import time
import random
import datetime
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
# def assertCheck(self, filename, queryResult, expectResult):
# self.filename = filename
# self.queryResult = queryResult
# self.expectResult = expectResult
# args0 = (filename, queryResult, expectResult)
# assert queryResult == expectResult, "Queryfile:%s ,result is %s != expect: %s" % args0
def assertfileDataExport(self, filename, expectResult):
self.filename = filename
self.expectResult = expectResult
with open("%s" % filename, 'r+') as f1:
for line in f1.readlines():
queryResultTaosc = line.strip().split(',')[0]
# self.assertCheck(filename, queryResultTaosc, expectResult)
def run(self):
starttime = 1537146000000
tdSql.prepare()
tdSql.execute("drop database if exists db_json;")
print("==============step1 tag format =======")
tdLog.info("create database db_jsonB ")
tdSql.execute("create database db_jsonB")
tdSql.execute("use db_jsonB")
# test Benchmark
tdSql.execute("create table if not exists jsons1(ts timestamp,dataFloat float) tags(jtag json)")
for numTables in range(500):
json = "{\"loc1%d\":\"beijingandshanghaiandchangzhouandshijiazhuanganda%d\",\"loc2%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandb%d\" ,\"loc3%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandc%d\",\
\"loc4%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandd%d\",\"loc5%d\":\"beijingandshanghaiandchangzhouandshijiazhuangande%d\",\"loc6%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandf%d\",\
\"loc7%d\":\"beijingandshanghaiandchangzhouandshijiazhuangandg%d\"}"% (numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables,numTables)
print(json)
createTableSqls = "create table if not exists jsons1_%d using jsons1 tags('%s')" %(numTables,json)
print(createTableSqls)
tdLog.info(createTableSqls)
tdSql.execute(createTableSqls)
for numRecords in range(1,101):
dataFloatSql=numRecords*10+numRecords*0.01
insertDataSqls = "insert into jsons1_%d values(%d+%ds, %d) " %(numTables,starttime,numRecords,dataFloatSql)
tdLog.info(insertDataSqls)
tdSql.execute(insertDataSqls)
tdSql.execute("use db_jsonB")
now_time1 = datetime.datetime.now()
tdSql.query("select * from jsons1 where ts>1537145900000 and ts<1537156000000;")
spendTimes1 = datetime.datetime.now() - now_time1
print(spendTimes1)
now_time2 = datetime.datetime.now()
tdSql.query("select * from jsons1 where ts>1537156000000;")
spendTimes2 = datetime.datetime.now() - now_time2
print(spendTimes2)
tdSql.execute("drop database db_jsonB")
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert_res.txt")
os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -12,6 +12,7 @@
# -*- coding: utf-8 -*-
import sys
import os
import taos
from util.log import tdLog
from util.cases import tdCases
......@@ -25,6 +26,21 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
# def assertCheck(self, filename, queryResult, expectResult):
# self.filename = filename
# self.queryResult = queryResult
# self.expectResult = expectResult
# args0 = (filename, queryResult, expectResult)
# assert queryResult == expectResult, "Queryfile:%s ,result is %s != expect: %s" % args0
def assertfileDataExport(self, filename, expectResult):
self.filename = filename
self.expectResult = expectResult
with open("%s" % filename, 'r+') as f1:
for line in f1.readlines():
queryResultTaosc = line.strip().split(',')[0]
# self.assertCheck(filename, queryResultTaosc, expectResult)
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db_json;")
......@@ -62,8 +78,18 @@ class TDTestCase:
tdSql.error("CREATE TABLE if not exists jsons4_1 using jsons4 tags('{\"%s1\":5}')" % char2) # len(key)=257
tdSql.execute("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"T\":\"%s\"}')" % char3) # len(object)=4096
tdSql.error("CREATE TABLE if not exists jsons4_2 using jsons4 tags('{\"TS\":\"%s\"}')" % char3) # len(object)=4097
# test the min/max length of double type , and int64 is not required
tdSql.error("CREATE TABLE if not exists jsons4_3 using jsons4 tags('{\"doublength\":-1.8e308}')")
tdSql.error("CREATE TABLE if not exists jsons4_3 using jsons4 tags('{\"doublength\":1.8e308}')")
tdSql.execute("CREATE TABLE if not exists jsons4_4 using jsons4 tags('{\"doublength\":-1.7e308}')")
tdSql.execute("CREATE TABLE if not exists jsons4_5 using jsons4 tags('{\"doublength\":1.71e308}')")
tdSql.query("select jtag from jsons4 where jtag->'doublength'<-1.69e+308;")
tdSql.checkRows(1)
tdSql.query("select jtag from jsons4 where jtag->'doublength'>1.7e+308;")
tdSql.checkRows(1)
tdSql.execute("insert into jsons1_1 values(now, 1, 'json1')")
tdSql.execute("insert into jsons1_1 values(now+2s, 1, 'json1')")
tdSql.execute("insert into jsons1_1 values(now+1s, 1, 'json1')")
tdSql.execute("insert into jsons1_2 using jsons1 tags('{\"num\":5,\"location\":\"beijing\"}') values (now, 1, 'json2')")
tdSql.execute("insert into jsons1_3 using jsons1 tags('{\"num\":34,\"location\":\"beijing\",\"level\":\"l1\"}') values (now, 1, 'json3')")
......@@ -194,15 +220,12 @@ class TDTestCase:
tdSql.checkRows(0)
# # test where condition in
# tdSql.query("select * from jsons1 where jtag->'location' in ('beijing')")
tdSql.error("select * from jsons1 where jtag->'location' in ('beijing')")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'num' in (5,34)")
tdSql.error("select * from jsons1 where jtag->'num' in (5,34)")
# tdSql.checkRows(2)
# tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)")
# tdSql.query("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55")
tdSql.error("select * from jsons1 where jtag->'num' in ('5',34)")
tdSql.error("select * from jsons1 where jtag->'location' in ('beijing') and jtag->'class'=55")
# tdSql.checkRows(1)
# test where condition match
......@@ -412,8 +435,25 @@ class TDTestCase:
tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';")
tdSql.checkRows(1)
tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;")
tdSql.query("select count(jtag) from jsons1 ;")
tdSql.checkData(0, 0, 15)
tdSql.error("select count( jtag->'location'='beijing') from jsons1 ;")
tdSql.error("select count( jtag contains 'age') from jsons1 ;")
functionName = ['avg','twa','irate','stddev', 'stddev', 'leastsquares']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
# tdSql.error("select avg( jtag) from jsons1 ;")
# tdSql.error("select avg( jtag->'location'='beijing') from jsons1 ;")
# tdSql.error("select avg( jtag contains 'age') from jsons1 ;")
# Select_exprs is SQL function -Selection function
......@@ -467,6 +507,13 @@ class TDTestCase:
tdSql.checkRows(4)
tdSql.checkData(0,1,2)
tdSql.checkData(2,1,4)
#error
functionName = ['min','max','last','TOP','last_row','bottom','apercentile','interp']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
# Select_exprs is SQL function -Calculation function
tdSql.error(" select diff(dataint) from jsons1 where jtag->'location'= 'beijing' or jtag->'location'= 'tianjing'or jtag contains 'num' or jtag->'age'=35 ;")
......@@ -500,13 +547,21 @@ class TDTestCase:
tdSql.query("select ts,round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';")
tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag contains 'tea';")
functionName = ['diff','Derivative','SPREAD','ceil','round','floor']
print(functionName)
for fn in functionName:
tdSql.error("select %s( jtag) from jsons1 ;"%fn)
tdSql.error("select %s( jtag->'location'='beijing') from jsons1 ;"%fn)
tdSql.error("select %s( jtag contains 'age') from jsons1 ;"%fn)
#modify one same key and diffirent data type,include negative number of double
tdSql.execute("insert into jsons7_4 using jsons7 tags('{\"nv\":null,\"tea\":123,\"tag\":123,\"tea\":false}') values (now+1s,5,'true',4.01,2.2,'abc'); ")
tdSql.execute("insert into jsons7_5 using jsons7 tags('{\"nv\":null,\"tea\":\"app\",\"tag\":123,\"tea\":false}') values (now+2s,5,'true',4.01,2.2,'abc'); ")
tdSql.error("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111111111111111111111111111111111111111111111111111111111111111,\"tag\":123,\"tea\":false}') values (now+3s,5,'true',4.01,2.2,'123'); ")
tdSql.execute("insert into jsons7_6 using jsons7 tags('{\"nv\":null,\"tea\":-1.111111111,\"tag\":123,\"tea\":false}') values (now,5,'false',4.01,2.2,'t123'); ")
tdSql.query("select jtag from jsons7 where jtag->'tea'>-1.01;")
# tdSql.checkRows(2)
tdSql.query("select jtag from jsons7 where jtag->'tea'<-1.01;")
tdSql.checkRows(1)
# test join
tdSql.execute("create table if not exists jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
......@@ -572,6 +627,36 @@ class TDTestCase:
tdSql.query(" select stddev(dataint) from jsons8 group by datatime;")
tdSql.error(" select stddev(datatime) from jsons8 group by datadouble;")
# # verify the tag length of the super table and the child table
# TD-12389
# tdSql.query("describe jsons1;")
# jtagLengthSup=tdSql.queryResult[3][2]
# tdSql.query("describe jsons1_1;")
# tdSql.checkData(3, 2, jtagLengthSup)
# #test import and export
# tdSql.execute("select * from jsons1 >> jsons1_data.csv;")
# tdSql.query("select * from jsons1 ")
# with open("./jsons1_data.csv", 'r+') as f1:
# # count=len(open("./jsons1_data.csv",'rU').readlines())
# # print(count)
# rows=0
# for line in f1.readlines():
# # for columns in range(4): # it will be replaced with column length later,but now it is setted to a fixed value first
# queryResultInt = line.strip().split(',')[1]
# # queryResultTag = line.strip().split(',')[3]
# # for rows in range(9):
# # print(rows,1,queryResultInt,queryResultTag)
# tdSql.checkData(rows, 1, "%s" %queryResultInt)
# # tdSql.checkData(rows, 3, "%s" %queryResultTag)
# rows +=1
# # test taos -f
# os.system("taos -f stable/json_tag_extra.py.sql ")
# tdSql.execute("use db_json")
# tdSql.query("select * from jsons1")
# tdSql.checkRows(9)
# # test drop tables and databases
# tdSql.execute("drop table jsons1_1")
......@@ -579,7 +664,10 @@ class TDTestCase:
# tdSql.execute("drop stable jsons3")
# tdSql.execute("drop stable jsons2")
# tdSql.execute("drop database db_json")
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert_res.txt")
os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
def stop(self):
......
......@@ -42,7 +42,7 @@
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "taosc",
"insert_rows": 150,
"insert_rows": 100,
"childtable_limit": -1,
"childtable_offset":0,
"multi_thread_write_one_tbl": "no",
......@@ -58,6 +58,138 @@
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb1",
"child_table_exists":"no",
"childtable_count": 20,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "rest",
"insert_rows": 100,
"childtable_limit": -1,
"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": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb2",
"child_table_exists":"no",
"childtable_count": 30,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "stmt",
"insert_rows": 100,
"childtable_limit": -1,
"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": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb3",
"child_table_exists":"no",
"childtable_count": 40,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"insert_rows": 100,
"childtable_limit": -1,
"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": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}, {"type": "DOUBLE", "count":1}, {"type": "BINARY", "len": 16, "count":2}, {"type": "nchar", "len": 32, "count":2}],
"tags": [{"type": "TINYINT", "count":2}, {"type": "BINARY","count":1}, {"type": "nchar", "count":2}]
},
{
"name": "stb4",
"child_table_exists":"no",
"childtable_count": 50,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet",
"insert_rows": 100,
"childtable_limit": -1,
"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": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT", "count":2}]
},
{
"name": "stb5",
"child_table_exists":"no",
"childtable_count": 60,
"childtable_prefix": "stb00_",
"auto_create_table": "no",
"batch_create_tbl_num": 20,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json",
"insert_rows": 100,
"childtable_limit": -1,
"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": "./sample.csv",
"tags_file": "",
"columns": [{"type": "INT"}],
"tags": [{"type": "TINYINT"}]
}]
}]
}
......@@ -85,16 +85,16 @@
"tags": [{"type": "TINYINT", "count":1}]
},
{
"name": "stb3",
"name": "stb2",
"child_table_exists":"no",
"childtable_count": 5,
"childtable_count": 3,
"childtable_prefix": "stb03_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -111,16 +111,16 @@
"tags": [{"type": "BIGINT", "count":1}]
},
{
"name": "stb4",
"name": "stb3",
"child_table_exists":"no",
"childtable_count": 20,
"childtable_count": 4,
"childtable_prefix": "stb04_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -137,16 +137,16 @@
"tags": [{"type": "SMALLINT", "count":1}]
},
{
"name": "stb5",
"name": "stb4",
"child_table_exists":"no",
"childtable_count": 40,
"childtable_count": 5,
"childtable_prefix": "stb05_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -163,16 +163,16 @@
"tags": [{"type": "FLOAT", "count":1}]
},
{
"name": "stb6",
"name": "stb5",
"child_table_exists":"no",
"childtable_count": 15,
"childtable_count": 6,
"childtable_prefix": "stb06_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -188,17 +188,43 @@
"columns": [{"type": "DOUBLE"}],
"tags": [{"type": "DOUBLE", "count":1}]
},
{
"name": "stb6",
"child_table_exists":"no",
"childtable_count": 7,
"childtable_prefix": "stb01_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
"insert_interval":0,
"max_sql_len": 1025000,
"disorder_ratio": 0,
"disorder_range": 1000,
"timestamp_step": 1,
"start_timestamp": "2012-10-01 00:00:00.000",
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [{"type": "UINT"}],
"tags": [{"type": "UINT", "count":1}]
},
{
"name": "stb7",
"child_table_exists":"no",
"childtable_count": 10,
"childtable_count": 8,
"childtable_prefix": "stb07_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -217,14 +243,14 @@
{
"name": "stb8",
"child_table_exists":"no",
"childtable_count": 20,
"childtable_count": 9,
"childtable_prefix": "stb08_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -243,14 +269,14 @@
{
"name": "stb9",
"child_table_exists":"no",
"childtable_count": 3,
"childtable_count": 10,
"childtable_prefix": "stb09_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "json" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -269,14 +295,14 @@
{
"name": "stb10",
"child_table_exists":"no",
"childtable_count": 3,
"childtable_count": 11,
"childtable_prefix": "stb10_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -295,14 +321,14 @@
{
"name": "stb11",
"child_table_exists":"no",
"childtable_count": 3,
"childtable_count": 12,
"childtable_prefix": "stb11_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......@@ -321,14 +347,14 @@
{
"name": "stb12",
"child_table_exists":"no",
"childtable_count": 3,
"childtable_count": 13,
"childtable_prefix": "stb12_",
"auto_create_table": "no",
"batch_create_tbl_num": 100,
"data_source": "rand",
"insert_mode": "sml",
"line_protocol": "telnet" ,
"insert_rows":50,
"insert_rows":10,
"childtable_limit": -1,
"childtable_offset":0,
"interlace_rows": 32767,
......
......@@ -97,15 +97,15 @@ class TDTestCase:
tdSql.checkData(0, 0, 4000)
# # insert-interface: sml-json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# for i in range(13):
# for j in range(13):
# if tdSql.queryResult[i][0] == 'stb%d'%j:
# # print(i,"stb%d"%j)
# tdSql.checkData(i, 4, j+1)
# insert-interface: sml-json
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-sml-json-alltype.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
for i in range(13):
for j in range(13):
if tdSql.queryResult[i][0] == 'stb%d'%j:
# print(i,"stb%d"%j)
tdSql.checkData(i, 4, j+1)
# insert-interface: sml-telnet
......
......@@ -95,18 +95,18 @@ class TDTestCase:
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 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;")
......@@ -121,7 +121,7 @@ class TDTestCase:
tdLog.info("all data type")
tdSql.execute("drop database db1;")
# all data type
# 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))
......@@ -132,6 +132,43 @@ class TDTestCase:
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;")
......@@ -164,11 +201,18 @@ class TDTestCase:
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
# 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*")
......
......@@ -52,319 +52,324 @@ class TDTestCase:
os.system("rm -rf ./insert*_res.txt*")
os.system("rm -rf tools/taosdemoAllTest/%s.sql" % testcaseFilename )
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 11)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1100)
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 2000)
# # restful connector insert data
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
# # insert: create one or mutiple tables per sql and insert multiple rows per sql
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tnt1r.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.checkData(0, 0, 11)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 1100)
# tdSql.query("select count(*) from stb01_1")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 2000)
# # # restful connector insert data
# # os.system("%staosBenchmark -f tools/taosdemoAllTest/insertRestful.json -y " % binPath)
# # tdSql.execute("use db")
# # tdSql.query("select count (tbname) from stb0")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count (tbname) from stb1")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count(*) from stb00_0")
# # tdSql.checkData(0, 0, 10)
# # tdSql.query("select count(*) from stb0")
# # tdSql.checkData(0, 0, 100)
# # tdSql.query("select count(*) from stb01_1")
# # tdSql.checkData(0, 0, 20)
# # tdSql.query("select count(*) from stb1")
# # tdSql.checkData(0, 0, 200)
# # default values json files
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -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("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 20)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 1000)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 4000)
# # insert: using parament "insert_interval to controls spped of insert.
# # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# tdSql.checkData(0, 4, 10)
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 2000)
# tdSql.query("show stables")
# tdSql.checkData(1, 4, 20)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 4000)
# # spend 2min30s for 3 testcases.
# # insert: drop and child_table_exists combination test
# # insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
# tdSql.error("show dbno.stables")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 5)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 6)
# tdSql.query("select count (tbname) from stb2")
# tdSql.checkData(0, 0, 7)
# tdSql.query("select count (tbname) from stb3")
# tdSql.checkData(0, 0, 8)
# tdSql.query("select count (tbname) from stb4")
# tdSql.checkData(0, 0, 8)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 50)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 240)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 220)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 180)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 160)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 150)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 360)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 360)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 340)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 400)
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 50)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 120)
# tdSql.query("select count(*) from stb2")
# tdSql.checkData(0, 0, 140)
# tdSql.query("select count(*) from stb3")
# tdSql.checkData(0, 0, 160)
# tdSql.query("select count(*) from stb4")
# tdSql.checkData(0, 0, 160)
# # insert: let parament in json file is illegal, it'll expect error.
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y " % binPath)
# tdSql.error("select * from db.stb0")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(0)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables like 'stb0%' ")
# tdSql.checkData(0, 2, 11)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
# tdSql.error("use db1")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(1)
# tdSql.query("select count(*) from db.stb1")
# tdSql.checkRows(1)
# tdSql.error("select * from db.stb4")
# tdSql.error("select * from db.stb2")
# tdSql.query("select count(*) from db.stb3")
# tdSql.checkRows(1)
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath)
# tdSql.error("select * from db.stb4")
# tdSql.error("select * from db.stb2")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
# tdSql.error("select count(*) from db.stb0")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
# tdSql.error("use db")
# tdSql.execute("drop database if exists blf")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
# tdSql.execute("use blf")
# tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
# tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
# tdSql.query("select first(ts) from blf.p_0_topics_2")
# tdSql.checkData(0, 0, "2019-10-01 00:00:00")
# tdSql.query("select last(ts) from blf.p_0_topics_6 ")
# tdSql.checkData(0, 0, "2020-09-29 23:59:00")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 5000000)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 5000000)
# # insert: timestamp and step
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 20)
# tdSql.query("select last(ts) from db.stb00_0")
# tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 200)
# tdSql.query("select last(ts) from db.stb01_0")
# tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 400)
# default values json files
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -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("%staosBenchmark -f tools/taosdemoAllTest/insert-1s1tntmr.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interval-speed.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkData(0, 4, 10)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 2000)
tdSql.query("show stables")
tdSql.checkData(1, 4, 20)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-nodbnodrop.json -y" % binPath)
tdSql.error("show dbno.stables")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newdb.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 5)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 6)
tdSql.query("select count (tbname) from stb2")
tdSql.checkData(0, 0, 7)
tdSql.query("select count (tbname) from stb3")
tdSql.checkData(0, 0, 8)
tdSql.query("select count (tbname) from stb4")
tdSql.checkData(0, 0, 8)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-offset.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 240)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 220)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-newtable.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 150)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 360)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 360)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 340)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 400)
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-renewdb.json -y" % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 120)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 140)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
# insert: let parament in json file is illegal, it'll expect error.
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNumLarge4096.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertSigcolumnsNum4096.json -y " % binPath)
tdSql.error("select * from db.stb0")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsAndTagNum4096.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkData(0, 0, 10000)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertInterlaceRowsLarge1M.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkRows(0)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertColumnsNum0.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables like 'stb0%' ")
tdSql.checkData(0, 2, 11)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTagsNumLarge128.json -y " % binPath)
tdSql.error("use db1")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151.json -y " % binPath)
tdSql.query("select count(*) from db.stb0")
tdSql.checkRows(1)
tdSql.query("select count(*) from db.stb1")
tdSql.checkRows(1)
tdSql.error("select * from db.stb4")
tdSql.error("select * from db.stb2")
tdSql.query("select count(*) from db.stb3")
tdSql.checkRows(1)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertBinaryLenLarge16374AllcolLar49151-error.json -y " % binPath)
tdSql.error("select * from db.stb4")
tdSql.error("select * from db.stb2")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReq0.json -y " % binPath)
tdSql.error("select count(*) from db.stb0")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertNumOfrecordPerReqless0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTab0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertChildTabLess0.json -y " % binPath)
tdSql.error("use db")
tdSql.execute("drop database if exists blf")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertTimestepMulRowsLargeint16.json -y " % binPath)
tdSql.execute("use blf")
tdSql.query("select ts from blf.p_0_topics_7 limit 262800,1")
tdSql.checkData(0, 0, "2020-03-31 12:00:00.000")
tdSql.query("select first(ts) from blf.p_0_topics_2")
tdSql.checkData(0, 0, "2019-10-01 00:00:00")
tdSql.query("select last(ts) from blf.p_0_topics_6 ")
tdSql.checkData(0, 0, "2020-09-29 23:59:00")
os.system("%staosBenchmark -f tools/taosdemoAllTest/insertMaxNumPerReq.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 5000000)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 5000000)
# insert: timestamp and step
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-timestep.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select last(ts) from db.stb00_0")
tdSql.checkData(0, 0, "2020-10-01 00:00:00.019000")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 200)
tdSql.query("select last(ts) from db.stb01_0")
tdSql.checkData(0, 0, "2020-11-01 00:00:00.190000")
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 400)
# # insert: disorder_ratio
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 1)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 1)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 10)
# insert: sample json
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample-ts.json -y " % binPath)
tdSql.execute("use dbtest123")
tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647)
tdSql.query("select c0 from stb0_0 order by ts")
tdSql.checkData(3, 0, 4)
tdSql.query("select count(*) from stb0 order by ts")
tdSql.checkData(0, 0, 40)
tdSql.query("select * from stb0_1 order by ts")
tdSql.checkData(0, 0, '2021-10-28 15:34:44.735')
tdSql.checkData(3, 0, '2021-10-31 15:34:44.735')
tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20)
tdSql.query("select * from stb1 where t2=127")
tdSql.checkRows(10)
tdSql.query("select * from stb1 where t2=126")
tdSql.checkRows(10)
# insert: sample json
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
tdSql.execute("use dbtest123")
tdSql.query("select c2 from stb0")
tdSql.checkData(0, 0, 2147483647)
tdSql.query("select * from stb1 where t1=-127")
tdSql.checkRows(20)
tdSql.query("select * from stb1 where t2=127")
tdSql.checkRows(10)
tdSql.query("select * from stb1 where t2=126")
tdSql.checkRows(10)
# insert: test interlace parament
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 100)
tdSql.query("select count (*) from stb0")
tdSql.checkData(0, 0, 15000)
# # insert: auto_create
tdSql.execute('drop database if exists db')
tdSql.execute('create database db')
tdSql.execute('use db')
os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies
tdSql.execute('use db')
tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes
tdSql.checkRows(20)
tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no
tdSql.checkRows(0)
tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123
tdSql.checkRows(0)
tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes
tdSql.checkRows(0)
tdSql.execute('drop database if exists db')
os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies
tdSql.execute('use db')
tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes
tdSql.checkRows(20)
tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no
tdSql.checkRows(20)
tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123
tdSql.checkRows(20)
tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes
tdSql.checkRows(20)
# insert: test chinese encoding
os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (*) from stb0")
tdSql.checkData(0, 0, 1500)
# # # insert: disorder_ratio
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-disorder.json -g 2>&1 -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 1)
# tdSql.query("select count (tbname) from stb1")
# tdSql.checkData(0, 0, 1)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 10)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 10)
# # insert: sample json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample-ts.json -y " % binPath)
# tdSql.execute("use dbtest123")
# tdSql.query("select c2 from stb0")
# tdSql.checkData(0, 0, 2147483647)
# tdSql.query("select c0 from stb0_0 order by ts")
# tdSql.checkData(3, 0, 4)
# tdSql.query("select count(*) from stb0 order by ts")
# tdSql.checkData(0, 0, 40)
# tdSql.query("select * from stb0_1 order by ts")
# tdSql.checkData(0, 0, '2021-10-28 15:34:44.735')
# tdSql.checkData(3, 0, '2021-10-31 15:34:44.735')
# tdSql.query("select * from stb1 where t1=-127")
# tdSql.checkRows(20)
# tdSql.query("select * from stb1 where t2=127")
# tdSql.checkRows(10)
# tdSql.query("select * from stb1 where t2=126")
# tdSql.checkRows(10)
# # insert: sample json
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-sample.json -y " % binPath)
# tdSql.execute("use dbtest123")
# tdSql.query("select c2 from stb0")
# tdSql.checkData(0, 0, 2147483647)
# tdSql.query("select * from stb1 where t1=-127")
# tdSql.checkRows(20)
# tdSql.query("select * from stb1 where t2=127")
# tdSql.checkRows(10)
# tdSql.query("select * from stb1 where t2=126")
# tdSql.checkRows(10)
# # insert: test interlace parament
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-interlace-row.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
# tdSql.checkData(0, 0, 100)
# tdSql.query("select count (*) from stb0")
# tdSql.checkData(0, 0, 15000)
# # # insert: auto_create
# tdSql.execute('drop database if exists db')
# tdSql.execute('create database db')
# tdSql.execute('use db')
# os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-N00.json " % binPath) # drop = no, child_table_exists, auto_create_table varies
# tdSql.execute('use db')
# tdSql.query('show tables like \'NN123%\'') #child_table_exists = no, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NNN%\'') #child_table_exists = no, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NNY%\'') #child_table_exists = no, auto_create_table varies = yes
# tdSql.checkRows(20)
# tdSql.query('show tables like \'NYN%\'') #child_table_exists = yes, auto_create_table varies = no
# tdSql.checkRows(0)
# tdSql.query('show tables like \'NY123%\'') #child_table_exists = yes, auto_create_table varies = 123
# tdSql.checkRows(0)
# tdSql.query('show tables like \'NYY%\'') #child_table_exists = yes, auto_create_table varies = yes
# tdSql.checkRows(0)
# tdSql.execute('drop database if exists db')
# os.system("%staosBenchmark -y -f tools/taosdemoAllTest/insert-drop-exist-auto-Y00.json " % binPath) # drop = yes, child_table_exists, auto_create_table varies
# tdSql.execute('use db')
# tdSql.query('show tables like \'YN123%\'') #child_table_exists = no, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YNN%\'') #child_table_exists = no, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YNY%\'') #child_table_exists = no, auto_create_table varies = yes
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YYN%\'') #child_table_exists = yes, auto_create_table varies = no
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YY123%\'') #child_table_exists = yes, auto_create_table varies = 123
# tdSql.checkRows(20)
# tdSql.query('show tables like \'YYY%\'') #child_table_exists = yes, auto_create_table varies = yes
# tdSql.checkRows(20)
# # insert: test chinese encoding
# # TD-11399、TD-10819
# os.system("%staosBenchmark -f tools/taosdemoAllTest/insert-chinese.json -y " % binPath)
# tdSql.execute("use db")
# tdSql.query("show stables")
# for i in range(6):
# for j in range(6):
# if tdSql.queryResult[i][0] == 'stb%d'%j:
# # print(i,"stb%d"%j)
# tdSql.checkData(i, 4, (j+1)*10)
# for i in range(13):
# tdSql.query("select count(*) from stb%d"%i)
# tdSql.checkData(0, 0, (i+1)*100)
# rm useless files
os.system("rm -rf ./insert*_res.txt*")
......
......@@ -74,22 +74,23 @@ class TDTestCase:
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 3000)
# # insert: using parament "insert_interval to controls spped of insert.
# # but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath)
# tdSql.execute("use db")
# tdSql.query("select tbname from db.stb0")
# tdSql.checkRows(100 )
# # tdSql.query("select count(*) from stb00_0")
# # tdSql.checkData(0, 0, 20)
# tdSql.query("select count(*) from stb0")
# tdSql.checkData(0, 0, 2000)
# tdSql.query("show stables")
# tdSql.checkData(1, 4, 20)
# # tdSql.query("select count(*) from stb01_0")
# # tdSql.checkData(0, 0, 35)
# tdSql.query("select count(*) from stb1")
# tdSql.checkData(0, 0, 700)
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insert-interval-speed-sml.json -y" % binPath)
tdSql.execute("use db")
# tdSql.query("select count (tbname) from stb0")
tdSql.query("select tbname from db.stb0")
tdSql.checkRows(100 )
# tdSql.query("select count(*) from stb00_0")
# tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 2000)
tdSql.query("show stables")
tdSql.checkData(1, 4, 20)
# tdSql.query("select count(*) from stb01_0")
# tdSql.checkData(0, 0, 35)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 700)
# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
......@@ -134,10 +135,13 @@ class TDTestCase:
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsAndTagNum4096-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkData(0, 0, 10000)
# there is no limit of 4096 columns,so cancels this case
# tdSql.execute("drop database if exists db")
# os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertInterlaceRowsLarge1M-sml.json -y " % binPath)
# tdSql.query("select count(*) from db.stb0")
# tdSql.checkRows(0)
tdSql.execute("drop database if exists db")
os.system("%staosBenchmark -f tools/taosdemoAllTest/sml/insertColumnsNum0-sml.json -y " % binPath)
tdSql.execute("use db")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册