提交 9955c907 编写于 作者: J jiajingbin

finish testcases

上级 44ec3f14
......@@ -15,13 +15,11 @@ import traceback
import random
from taos.error import SchemalessError
import time
from copy import deepcopy
import numpy as np
from util.log import *
from util.cases import *
from util.sql import *
from util.common import tdCom
from util.types import TDSmlProtocolType, TDSmlTimestampType
from util.types import TDSmlProtocolType
import threading
import json
......@@ -113,7 +111,6 @@ class TDTestCase:
stb_tag_dict = input_json["tags"]
stb_col_dict = input_json["value"]
ts_value = self.timeTrans(input_json["timestamp"])
tag_name_list = []
tag_value_list = []
td_tag_value_list = []
......@@ -126,7 +123,7 @@ class TDTestCase:
# handle tag
for key,value in stb_tag_dict.items():
if "id" in key.lower():
if "id" == key.lower():
tb_name = value
else:
if type(value) is dict:
......@@ -455,6 +452,7 @@ class TDTestCase:
"""
normal tags and cols, one for every elm
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(value_type=value_type)
self.resCmp(input_json, stb_name)
......@@ -463,6 +461,7 @@ class TDTestCase:
"""
check all normal type
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list:
......@@ -483,6 +482,7 @@ class TDTestCase:
please test :
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = binary_symbols
......@@ -498,6 +498,7 @@ class TDTestCase:
test ts list --> ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
# ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
ts_list = ["1626006833639000000ns", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006834", 0]
for ts in ts_list:
......@@ -563,6 +564,7 @@ class TDTestCase:
check id.index in tags
eg: t0=**,id=**,t1=**
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(id_change_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name)
......@@ -572,6 +574,7 @@ class TDTestCase:
check id param
eg: id and ID
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(id_upper_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name)
......@@ -584,6 +587,7 @@ class TDTestCase:
"""
id not exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(id_noexist_tag=True, value_type=value_type)
self.resCmp(input_json, stb_name)
......@@ -598,6 +602,7 @@ class TDTestCase:
"""
max tag count is 128
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
for input_json in [self.genLongJson(128, value_type)[0]]:
tdCom.cleanTb()
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
......@@ -613,6 +618,7 @@ class TDTestCase:
test illegal id name
mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
rstr = list("`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?")
for i in rstr:
......@@ -626,6 +632,7 @@ class TDTestCase:
"""
id is start with num
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(tb_name="1aaabbb", value_type=value_type)[0]
try:
......@@ -637,6 +644,7 @@ class TDTestCase:
"""
check now unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="now", t_type="ns", value_type=value_type))[0]
try:
......@@ -648,6 +656,7 @@ class TDTestCase:
"""
check date format ts unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="2021-07-21\ 19:01:46.920", t_type="ns", value_type=value_type))[0]
try:
......@@ -659,6 +668,7 @@ class TDTestCase:
"""
check ts format like 16260068336390us19
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(ts_value=self.genTsColValue(value="16260068336390us19", t_type="us", value_type=value_type))[0]
try:
......@@ -673,9 +683,10 @@ class TDTestCase:
chech upper tag
length of stb_name tb_name <= 192
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name_192 = tdCom.getLongName(len=192, mode="letters")
tb_name_192 = tdCom.getLongName(len=192, mode="letters")
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(stb_name=stb_name_192, tb_name=tb_name_192, value_type=value_type)
self.resCmp(input_json, stb_name)
tdSql.query(f'select * from {stb_name}')
......@@ -692,10 +703,11 @@ class TDTestCase:
def tagNameLengthCheckCase(self):
"""
check tag name limit <= 64
check tag name limit <= 62
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tag_name = tdCom.getLongName(63, "letters")
tag_name = tdCom.getLongName(61, "letters")
tag_name = f'T{tag_name}'
stb_name = tdCom.getLongName(7, "letters")
input_json = {'metric': stb_name, 'timestamp': {'value': 1626006833639000000, 'type': 'ns'}, 'value': "bcdaaa", 'tags': {tag_name: {'value': False, 'type': 'bool'}}}
......@@ -711,6 +723,7 @@ class TDTestCase:
"""
check full type tag value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# i8
for t1 in [-127, 127]:
......@@ -831,6 +844,7 @@ class TDTestCase:
"""
check full type col value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# i8
for value in [-127, 127]:
......@@ -970,6 +984,7 @@ class TDTestCase:
"""
test illegal tag col value
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
......@@ -1018,6 +1033,7 @@ class TDTestCase:
"""
check duplicate Id Tag Col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(id_double_tag=True, value_type=value_type)[0]
try:
......@@ -1038,6 +1054,7 @@ class TDTestCase:
"""
case no id when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(tb_name="sub_table_0123456", col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type))
self.resCmp(input_json, stb_name)
......@@ -1050,6 +1067,7 @@ class TDTestCase:
"""
check duplicate insert when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(value_type=value_type)
self.resCmp(input_json, stb_name)
......@@ -1073,6 +1091,7 @@ class TDTestCase:
"""
check length increase
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = "test_crash"
input_json = self.genFullTypeJson(stb_name=stb_name)[0]
......@@ -1095,6 +1114,7 @@ class TDTestCase:
* col is added without value when update==0
* col is added with value when update==1
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]:
......@@ -1120,6 +1140,7 @@ class TDTestCase:
"""
check tag count add
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type))
......@@ -1136,6 +1157,7 @@ class TDTestCase:
condition: stb not change
insert two table, keep tag unchange, change col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value=True, t_type="bool", value_type=value_type), tag_value=self.genTagValue(t0_value=True, value_type=value_type), id_noexist_tag=True)
self.resCmp(input_json, stb_name)
......@@ -1158,6 +1180,7 @@ class TDTestCase:
"""
every binary and nchar must be length+2
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
......@@ -1203,6 +1226,7 @@ class TDTestCase:
"""
check nchar length limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
......@@ -1246,6 +1270,7 @@ class TDTestCase:
"""
test batch insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = "stb_name"
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
......@@ -1277,24 +1302,26 @@ class TDTestCase:
tdSql.checkRows(5)
def multiInsertCheckCase(self, count, value_type="obj"):
"""
test multi insert
"""
tdCom.cleanTb()
sql_list = list()
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
for i in range(count):
input_json = self.genFullTypeJson(stb_name=stb_name, col_value=self.genTsColValue(value=tdCom.getLongName(8, "letters"), t_type="binary", value_type=value_type), tag_value=self.genTagValue(t7_value=tdCom.getLongName(8, "letters"), value_type=value_type), id_noexist_tag=True)[0]
sql_list.append(input_json)
self._conn.schemaless_insert([json.dumps(sql_list)], TDSmlProtocolType.JSON.value, None)
tdSql.query('show tables')
tdSql.checkRows(count)
"""
test multi insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
sql_list = list()
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
for i in range(count):
input_json = self.genFullTypeJson(stb_name=stb_name, col_value=self.genTsColValue(value=tdCom.getLongName(8, "letters"), t_type="binary", value_type=value_type), tag_value=self.genTagValue(t7_value=tdCom.getLongName(8, "letters"), value_type=value_type), id_noexist_tag=True)[0]
sql_list.append(input_json)
self._conn.schemaless_insert([json.dumps(sql_list)], TDSmlProtocolType.JSON.value, None)
tdSql.query('show tables')
tdSql.checkRows(count)
def batchErrorInsertCheckCase(self):
"""
test batch error insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = [{"metric": "st123456", "timestamp": {"value": 1626006833639000000, "type": "ns"}, "value": {"value": "tt", "type": "bool"}, "tags": {"t1": {"value": 3, "type": "bigint"}, "t2": {"value": 4, "type": "double"}, "t3": {"value": "t3", "type": "binary"}}},
{"metric": "st123456", "timestamp": {"value": 1626006933641000000, "type": "ns"}, "value": {"value": 9, "type": "bigint"}, "tags": {"t1": {"value": 4, "type": "bigint"}, "t3": {"value": "t4", "type": "binary"}, "t2": {"value": 5, "type": "double"}, "t4": {"value": 5, "type": "double"}}}]
......@@ -1308,6 +1335,7 @@ class TDTestCase:
"""
test multi cols insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(c_multi_tag=True, value_type=value_type)[0]
try:
......@@ -1320,6 +1348,7 @@ class TDTestCase:
"""
test blank col insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(c_blank_tag=True, value_type=value_type)[0]
try:
......@@ -1332,6 +1361,7 @@ class TDTestCase:
"""
test blank tag insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(t_blank_tag=True, value_type=value_type)[0]
try:
......@@ -1344,6 +1374,7 @@ class TDTestCase:
"""
check nchar ---> chinese
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(chinese_tag=True)
self.resCmp(input_json, stb_name)
......@@ -1352,6 +1383,7 @@ class TDTestCase:
'''
multi_field
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(multi_field_tag=True, value_type=value_type)[0]
try:
......@@ -1361,6 +1393,8 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0)
def spellCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
input_json_list = [{"metric": f'{stb_name}_1', "timestamp": {"value": 1626006833639000000, "type": "Ns"}, "value": {"value": 1, "type": "Bigint"}, "tags": {"t1": {"value": 127, "type": "tinYint"}}},
{"metric": f'{stb_name}_2', "timestamp": {"value": 1626006833639000001, "type": "nS"}, "value": {"value": 32767, "type": "smallInt"}, "tags": {"t1": {"value": 32767, "type": "smallInt"}}},
......@@ -1378,6 +1412,7 @@ class TDTestCase:
self.resCmp(input_sql, stb_name)
def tbnameTagsColsNameCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = {'metric': 'rFa$sta', 'timestamp': {'value': 1626006834, 'type': 's'}, 'value': {'value': True, 'type': 'bool'}, 'tags': {'Tt!0': {'value': False, 'type': 'bool'}, 'tT@1': {'value': 127, 'type': 'tinyint'}, 't@2': {'value': 32767, 'type': 'smallint'}, 't$3': {'value': 2147483647, 'type': 'int'}, 't%4': {'value': 9223372036854775807, 'type': 'bigint'}, 't^5': {'value': 11.12345027923584, 'type': 'float'}, 't&6': {'value': 22.123456789, 'type': 'double'}, 't*7': {'value': 'binaryTagValue', 'type': 'binary'}, 't!@#$%^&*()_+[];:<>?,9': {'value': 'ncharTagValue', 'type': 'nchar'}, 'id': 'rFas$ta_1'}}
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
......@@ -1392,6 +1427,7 @@ class TDTestCase:
"""
metric value "." trans to "_"
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genFullTypeJson(point_trans_tag=True, value_type=value_type)[0]
self._conn.schemaless_insert([json.dumps(input_json)], TDSmlProtocolType.JSON.value, None)
......@@ -1460,6 +1496,7 @@ class TDTestCase:
"""
thread input different stb
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json = self.genSqlList(value_type=value_type)[0]
self.multiThreadRun(self.genMultiThreadSeq(input_json))
......@@ -1470,6 +1507,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
......@@ -1487,6 +1525,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, add columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
......@@ -1504,6 +1543,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, minus columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
......@@ -1521,6 +1561,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name)
......@@ -1533,6 +1574,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name)
......@@ -1550,6 +1592,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name)
......@@ -1562,6 +1605,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
......@@ -1581,6 +1625,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
......@@ -1602,6 +1647,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_json, stb_name = self.genFullTypeJson(tb_name=tb_name, col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
......@@ -1624,6 +1670,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary", value_type=value_type))
self.resCmp(input_json, stb_name)
......@@ -1636,6 +1683,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_json, stb_name = self.genFullTypeJson(col_value=self.genTsColValue(value="binaryTagValue", t_type="binary"))
self.resCmp(input_json, stb_name)
......@@ -1692,22 +1740,19 @@ class TDTestCase:
self.multiFieldCheckCase(value_type)
self.pointTransCheckCase(value_type)
self.stbInsertMultiThreadCheckCase(value_type)
# TODO
# self.tagNameLengthCheckCase()
self.tagNameLengthCheckCase()
self.boolTypeCheckCase()
self.batchErrorInsertCheckCase()
self.chineseCheckCase()
self.spellCheckCase()
self.tbnameTagsColsNameCheckCase()
# # MultiThreads
# mv to no value type
self.sStbStbDdataInsertMultiThreadCheckCase()
self.sStbStbDdataAtInsertMultiThreadCheckCase()
self.sStbStbDdataMtInsertMultiThreadCheckCase()
self.sStbDtbDdataInsertMultiThreadCheckCase()
self.sStbDtbDdataAtInsertMultiThreadCheckCase()
self.sStbDtbDdataDtsInsertMultiThreadCheckCase()
# end mv
self.sStbDtbDdataMtInsertMultiThreadCheckCase()
self.sStbStbDdataDtsInsertMultiThreadCheckCase()
self.sStbStbDdataDtsMtInsertMultiThreadCheckCase()
......
......@@ -318,6 +318,7 @@ class TDTestCase:
"""
normal tags and cols, one for every elm
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -326,6 +327,7 @@ class TDTestCase:
"""
check all normal type
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list:
......@@ -340,6 +342,7 @@ class TDTestCase:
please test :
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
binary_symbols = '"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"'
nchar_symbols = f'L{binary_symbols}'
......@@ -352,6 +355,7 @@ class TDTestCase:
"""
test ts list --> ["1626006833640ms", "1626006834s", "1626006822639022"]
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(ts=1626006833640)
self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.MILLI_SECOND.value)
......@@ -370,8 +374,8 @@ class TDTestCase:
tdSql.checkEqual(str(res[1][0]), "2021-07-11 20:33:53.641000")
def openTstbTelnetTsCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# for ts_tag in [TDSmlTimestampType.SECOND.value, TDSmlTimestampType.MICRO_SECOND.value, None]:
input_sql = f'{tdCom.getLongName(len=10, mode="letters")} 0 127 t0=127 t1=32767I16 t2=2147483647I32 t3=9223372036854775807 t4=11.12345027923584F32 t5=22.123456789F64'
stb_name = input_sql.split(" ")[0]
self.resCmp(input_sql, stb_name, ts=0)
......@@ -394,6 +398,7 @@ class TDTestCase:
check id.index in tags
eg: t0=**,id=**,t1=**
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_change_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -403,6 +408,7 @@ class TDTestCase:
check id param
eg: id and ID
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -415,6 +421,7 @@ class TDTestCase:
"""
id not exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -429,6 +436,7 @@ class TDTestCase:
"""
max tag count is 128
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
for input_sql in [self.genLongSql(128)[0]]:
tdCom.cleanTb()
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
......@@ -445,6 +453,7 @@ class TDTestCase:
test illegal id name
mix "`~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
rstr = list("~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?")
for i in rstr:
......@@ -456,6 +465,7 @@ class TDTestCase:
"""
id is start with num
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(tb_name="1aaabbb")
self.resCmp(input_sql, stb_name)
......@@ -464,6 +474,7 @@ class TDTestCase:
"""
check now unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="now")[0]
try:
......@@ -476,6 +487,7 @@ class TDTestCase:
"""
check date format ts unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try:
......@@ -488,6 +500,7 @@ class TDTestCase:
"""
check ts format like 16260068336390us19
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try:
......@@ -503,6 +516,7 @@ class TDTestCase:
chech upper tag
length of stb_name tb_name <= 192
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
stb_name_192 = tdCom.getLongName(len=192, mode="letters")
tb_name_192 = tdCom.getLongName(len=192, mode="letters")
tdCom.cleanTb()
......@@ -523,10 +537,11 @@ class TDTestCase:
def tagNameLengthCheckCase(self):
"""
check tag name limit <= 64
check tag name limit <= 62
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tag_name = tdCom.getLongName(62, "letters")
tag_name = tdCom.getLongName(61, "letters")
tag_name = f'T{tag_name}'
stb_name = tdCom.getLongName(7, "letters")
input_sql = f'{stb_name} 1626006833640 L"bcdaaa" {tag_name}=f'
......@@ -542,6 +557,7 @@ class TDTestCase:
"""
check full type tag value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# nchar
# * legal nchar could not be larger than 16374/4
......@@ -560,6 +576,7 @@ class TDTestCase:
"""
check full type col value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# i8
for value in ["-127i8", "127i8"]:
......@@ -679,6 +696,7 @@ class TDTestCase:
"""
test illegal tag col value
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
......@@ -714,6 +732,7 @@ class TDTestCase:
'''
check blank case
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql_list = [f'{tdCom.getLongName(7, "letters")} 1626006833640 "abc aaa" t0=t',
f'{tdCom.getLongName(7, "letters")} 1626006833640 t t0="abaaa"',
......@@ -729,6 +748,7 @@ class TDTestCase:
"""
check duplicate Id Tag Col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try:
......@@ -750,6 +770,7 @@ class TDTestCase:
"""
case no id when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", value="f")
self.resCmp(input_sql, stb_name)
......@@ -762,6 +783,7 @@ class TDTestCase:
"""
check duplicate insert when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -772,6 +794,7 @@ class TDTestCase:
"""
check length increase
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -788,6 +811,7 @@ class TDTestCase:
* col is added without value when update==0
* col is added with value when update==1
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]:
......@@ -813,6 +837,7 @@ class TDTestCase:
"""
check tag count add
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", value="f")
......@@ -829,6 +854,7 @@ class TDTestCase:
condition: stb not change
insert two table, keep tag unchange, change col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(t0="f", value="f", id_noexist_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -851,6 +877,7 @@ class TDTestCase:
"""
check nchar length limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
......@@ -875,6 +902,7 @@ class TDTestCase:
"""
test batch insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
......@@ -901,6 +929,7 @@ class TDTestCase:
"""
test multi insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
sql_list = []
stb_name = tdCom.getLongName(8, "letters")
......@@ -916,6 +945,7 @@ class TDTestCase:
"""
test batch error insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
lines = ["st123456 1626006833640 3i 64 t1=3i64 t2=4f64 t3=\"t3\"",
......@@ -930,6 +960,7 @@ class TDTestCase:
"""
test multi cols insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(c_multi_tag=True)[0]
try:
......@@ -942,6 +973,7 @@ class TDTestCase:
"""
test blank col insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(c_blank_tag=True)[0]
try:
......@@ -954,6 +986,7 @@ class TDTestCase:
"""
test blank tag insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(t_blank_tag=True)[0]
try:
......@@ -966,6 +999,7 @@ class TDTestCase:
"""
check nchar ---> chinese
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(chinese_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -974,6 +1008,7 @@ class TDTestCase:
'''
multi_field
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(multi_field_tag=True)[0]
try:
......@@ -983,6 +1018,8 @@ class TDTestCase:
tdSql.checkNotEqual(err.errno, 0)
def spellCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1 1626006833640 127I8 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
f'{stb_name}_2 1626006833640 32767I16 t0=127I8 t1=32767I16 t2=2147483647I32 t3=9223372036854775807I64 t4=11.12345027923584F32 t5=22.123456789F64',
......@@ -1002,6 +1039,7 @@ class TDTestCase:
"""
metric value "." trans to "_"
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(point_trans_tag=True)[0]
stb_name = f'`{input_sql.split(" ")[0]}`'
......@@ -1009,6 +1047,7 @@ class TDTestCase:
tdSql.execute("drop table `.point.trans.test`")
def defaultTypeCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1 1626006833640 9223372036854775807 t0=f t1=127 t2=32767i16 t3=2147483647i32 t4=9223372036854775807 t5=11.12345f32 t6=22.123456789f64 t7="vozamcts" t8=L"ncharTagValue"', \
......@@ -1021,7 +1060,9 @@ class TDTestCase:
self.resCmp(input_sql, stb_name)
def tbnameTagsColsNameCheckCase(self):
input_sql = 'rFa$sta 1626006834 9223372036854775807 id=rFas$ta_1 Tt!0=true tT@1=127Ii8 t#2=32767i16 \"t$3\"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"'
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = 'rFa$sta 1626006834 9223372036854775807 id=rFas$ta_1 Tt!0=true tT@1=127Ii8 t#2=32767i16 "t$3"=2147483647i32 t%4=9223372036854775807i64 t^5=11.12345f32 t&6=22.123456789f64 t*7=\"ddzhiksj\" t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\"'
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.TELNET.value, None)
query_sql = 'select * from `rfa$sta`'
query_res = tdSql.query(query_sql, True)
......@@ -1093,6 +1134,7 @@ class TDTestCase:
"""
thread input different stb
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genSqlList()[0]
self.multiThreadRun(self.genMultiThreadSeq(input_sql))
......@@ -1103,6 +1145,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1120,6 +1163,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, add columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1137,6 +1181,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, minus columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1154,6 +1199,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
......@@ -1166,6 +1212,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
......@@ -1182,6 +1229,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
......@@ -1194,6 +1242,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1213,6 +1262,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1230,6 +1280,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, value="\"binaryTagValue\"")
......@@ -1252,6 +1303,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
......@@ -1264,6 +1316,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(value="\"binaryTagValue\"")
self.resCmp(input_sql, stb_name)
......@@ -1299,8 +1352,7 @@ class TDTestCase:
self.dateFormatTsCheckCase()
self.illegalTsCheckCase()
self.tbnameCheckCase()
# TODO
# self.tagNameLengthCheckCase()
self.tagNameLengthCheckCase()
self.tagValueLengthCheckCase()
self.colValueLengthCheckCase()
self.tagColIllegalValueCheckCase()
......
......@@ -15,7 +15,6 @@ import traceback
import random
from taos.error import SchemalessError
import time
from copy import deepcopy
import numpy as np
from util.log import *
from util.cases import *
......@@ -348,6 +347,7 @@ class TDTestCase:
"""
normal tags and cols, one for every elm
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -356,6 +356,7 @@ class TDTestCase:
"""
check all normal type
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
full_type_list = ["f", "F", "false", "False", "t", "T", "true", "True"]
for t_type in full_type_list:
......@@ -370,6 +371,7 @@ class TDTestCase:
please test :
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\'\'"\"'
'''
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
binary_symbols = '\"abcd`~!@#$%^&*()_-{[}]|:;<.>?lfjal"\"'
nchar_symbols = f'L{binary_symbols}'
......@@ -381,6 +383,7 @@ class TDTestCase:
test ts list --> ["1626006833639000000", "1626006833639019us", "1626006833640ms", "1626006834s", "1626006822639022"]
# ! us级时间戳都为0时,数据库中查询显示,但python接口拿到的结果不显示 .000000的情况请确认,目前修改时间处理代码可以通过
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(ts=1626006833639000000)
self.resCmp(input_sql, stb_name, ts_type=TDSmlTimestampType.NANO_SECOND.value)
......@@ -425,6 +428,7 @@ class TDTestCase:
self.createDb()
def zeroTsCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
for ts_tag in [TDSmlTimestampType.HOUR.value, TDSmlTimestampType.MINUTE.value, TDSmlTimestampType.SECOND.value, TDSmlTimestampType.MICRO_SECOND.value, TDSmlTimestampType.NANO_SECOND.value]:
input_sql = f'{tdCom.getLongName(len=10, mode="letters")},t0=127,t1=32767I16,t2=2147483647I32,t3=9223372036854775807,t4=11.12345027923584F32,t5=22.123456789F64 c0=127,c1=32767I16,c2=2147483647I32,c3=9223372036854775807,c4=11.12345027923584F32,c5=22.123456789F64 0'
......@@ -432,6 +436,7 @@ class TDTestCase:
self.resCmp(input_sql, stb_name, ts=0, precision=ts_tag)
def influxTsCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = f'{tdCom.getLongName(len=10, mode="letters")},t0=127,t1=32767I16,t2=2147483647I32,t3=9223372036854775807,t4=11.12345027923584F32,t5=22.123456789F64 c0=127,c1=32767I16,c2=2147483647I32,c3=9223372036854775807,c4=11.12345027923584F32,c5=22.123456789F64 454093'
stb_name = input_sql.split(",")[0]
......@@ -500,11 +505,12 @@ class TDTestCase:
tdSql.checkEqual(str(res[0][0]), "2021-07-11 20:50:33.639000")
def iuCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = f'{tdCom.getLongName(len=10, mode="letters")},t0=127 c1=9223372036854775807i,c2=1u 0'
stb_name = input_sql.split(",")[0]
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
res = tdSql.query(f'describe {stb_name}', True)
tdSql.query(f'describe {stb_name}', True)
tdSql.checkData(1, 1, "BIGINT")
tdSql.checkData(2, 1, "BIGINT UNSIGNED")
......@@ -513,6 +519,7 @@ class TDTestCase:
check id.index in tags
eg: t0=**,id=**,t1=**
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_change_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -522,6 +529,7 @@ class TDTestCase:
check id param
eg: id and ID
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_upper_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -534,6 +542,7 @@ class TDTestCase:
"""
id not exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(id_noexist_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -547,8 +556,9 @@ class TDTestCase:
def maxColTagCheckCase(self):
"""
max tag count is 128
max col count is ??
max col count is 4096
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
for input_sql in [self.genLongSql(128, 1)[0], self.genLongSql(1, 4094)[0]]:
tdCom.cleanTb()
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
......@@ -565,6 +575,7 @@ class TDTestCase:
test illegal id name
mix "~!@#$¥%^&*()-+={}|[]、「」【】\:;《》<>?"
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
rstr = list("~!@#$¥%^&*()-+=|[]、「」【】\;:《》<>?")
for i in rstr:
......@@ -577,6 +588,7 @@ class TDTestCase:
"""
id is start with num
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(tb_name="1aaabbb")
self.resCmp(input_sql, stb_name)
......@@ -585,6 +597,7 @@ class TDTestCase:
"""
check now unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="now")[0]
try:
......@@ -597,6 +610,7 @@ class TDTestCase:
"""
check date format ts unsupported
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="2021-07-21\ 19:01:46.920")[0]
try:
......@@ -609,6 +623,7 @@ class TDTestCase:
"""
check ts format like 16260068336390us19
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(ts="16260068336390us19")[0]
try:
......@@ -623,9 +638,10 @@ class TDTestCase:
chech upper tag
length of stb_name tb_name <= 192
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name_192 = tdCom.getLongName(len=192, mode="letters")
tb_name_192 = tdCom.getLongName(len=192, mode="letters")
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name_192, tb_name=tb_name_192)
self.resCmp(input_sql, stb_name)
tdSql.query(f'select * from {stb_name}')
......@@ -645,6 +661,7 @@ class TDTestCase:
"""
check full type tag value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# nchar
# * legal nchar could not be larger than 16374/4
......@@ -662,6 +679,7 @@ class TDTestCase:
"""
check full type col value limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# i8
for c1 in ["-127i8", "127i8"]:
......@@ -766,6 +784,7 @@ class TDTestCase:
"""
test illegal tag col value
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
# bool
for i in ["TrUe", "tRue", "trUe", "truE", "FalsE", "fAlse", "faLse", "falSe", "falsE"]:
......@@ -811,6 +830,7 @@ class TDTestCase:
"""
check duplicate Id Tag Col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql_id = self.genFullTypeSql(id_double_tag=True)[0]
try:
......@@ -848,6 +868,7 @@ class TDTestCase:
"""
case no id when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", c0="f")
self.resCmp(input_sql, stb_name)
......@@ -860,6 +881,7 @@ class TDTestCase:
"""
check duplicate insert when stb exist
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -870,6 +892,7 @@ class TDTestCase:
"""
check length increase
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -886,6 +909,7 @@ class TDTestCase:
* col is added without value when update==0
* col is added with value when update==1
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
for db_update_tag in [0, 1]:
......@@ -915,6 +939,7 @@ class TDTestCase:
"""
check column and tag count add
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name, t0="f", c0="f")
......@@ -931,6 +956,7 @@ class TDTestCase:
condition: stb not change
insert two table, keep tag unchange, change col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f", id_noexist_tag=True)
self.resCmp(input_sql, stb_name)
......@@ -953,6 +979,7 @@ class TDTestCase:
"""
every binary and nchar must be length+2
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
......@@ -979,6 +1006,7 @@ class TDTestCase:
"""
check nchar length limit
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(7, "letters")
tb_name = f'{stb_name}_1'
......@@ -1016,6 +1044,7 @@ class TDTestCase:
"""
test batch insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 bigint)')
......@@ -1038,24 +1067,26 @@ class TDTestCase:
tdSql.checkRows(5)
def multiInsertCheckCase(self, count):
"""
test multi insert
"""
tdCom.cleanTb()
sql_list = []
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 nchar(10))')
for i in range(count):
input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
sql_list.append(input_sql)
self._conn.schemaless_insert(sql_list, TDSmlProtocolType.LINE.value, None)
tdSql.query('show tables')
tdSql.checkRows(count)
"""
test multi insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
sql_list = []
stb_name = tdCom.getLongName(8, "letters")
tdSql.execute(f'create stable {stb_name}(ts timestamp, f int) tags(t1 nchar(10))')
for i in range(count):
input_sql = self.genFullTypeSql(stb_name=stb_name, t7=f'"{tdCom.getLongName(8, "letters")}"', c7=f'"{tdCom.getLongName(8, "letters")}"', id_noexist_tag=True)[0]
sql_list.append(input_sql)
self._conn.schemaless_insert(sql_list, TDSmlProtocolType.LINE.value, None)
tdSql.query('show tables')
tdSql.checkRows(count)
def batchErrorInsertCheckCase(self):
"""
test batch error insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
lines = ["st123456,t1=3i64,t2=4f64,t3=\"t3\" c1=3i 64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000",
......@@ -1070,6 +1101,7 @@ class TDTestCase:
"""
test multi cols insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(c_multi_tag=True)[0]
try:
......@@ -1082,6 +1114,7 @@ class TDTestCase:
"""
test multi tags insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(t_multi_tag=True)[0]
try:
......@@ -1094,6 +1127,7 @@ class TDTestCase:
"""
test blank col insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(c_blank_tag=True)[0]
try:
......@@ -1106,6 +1140,7 @@ class TDTestCase:
"""
test blank tag insert
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genFullTypeSql(t_blank_tag=True)[0]
try:
......@@ -1118,12 +1153,14 @@ class TDTestCase:
"""
check nchar ---> chinese
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql(chinese_tag=True)
self.resCmp(input_sql, stb_name)
def spellCheckCase(self):
stb_name = tdCom.getLongName(8, "letters")
tdCom.cleanTb()
input_sql_list = [f'{stb_name}_1,t0=127I8,t1=32767I16,t2=2147483647I32,t3=9223372036854775807I64,t4=11.12345027923584F32,t5=22.123456789F64 c0=127I8,c1=32767I16,c2=2147483647I32,c3=9223372036854775807I64,c4=11.12345027923584F32,c5=22.123456789F64 1626006833639000000',
f'{stb_name}_2,t0=127I8,t1=32767I16,t2=2147483647I32,t3=9223372036854775807I64,t4=11.12345027923584F32,t5=22.123456789F64 c0=127I8,c1=32767I16,c2=2147483647I32,c3=9223372036854775807I64,c4=11.12345027923584F32,c5=22.123456789F64 1626006833639000000',
f'{stb_name}_3,t0=127I8,t1=32767I16,t2=2147483647I32,t3=9223372036854775807I64,t4=11.12345027923584F32,t5=22.123456789F64 c0=127I8,c1=32767I16,c2=2147483647I32,c3=9223372036854775807I64,c4=11.12345027923584F32,c5=22.123456789F64 1626006833639000000',
......@@ -1139,6 +1176,8 @@ class TDTestCase:
self.resCmp(input_sql, stb_name)
def defaultTypeCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
stb_name = tdCom.getLongName(8, "letters")
input_sql_list = [f'{stb_name}_1,t0=127,t1=32767I16,t2=2147483647I32,t3=9223372036854775807,t4=11.12345027923584F32,t5=22.123456789F64 c0=127,c1=32767I16,c2=2147483647I32,c3=9223372036854775807,c4=11.12345027923584F32,c5=22.123456789F64 1626006833639000000',
f'{stb_name}_2,t0=127I8,t1=32767I16,t2=2147483647I32,t3=9223372036854775807I64,t4=11.12345027923584F32,t5=22.123456789 c0=127I8,c1=32767I16,c2=2147483647I32,c3=9223372036854775807I64,c4=11.12345027923584F32,c5=22.123456789 1626006833639000000',
......@@ -1150,6 +1189,8 @@ class TDTestCase:
self.resCmp(input_sql, stb_name)
def tbnameTagsColsNameCheckCase(self):
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = 'rFa$sta,id=rFas$ta_1,Tt!0=true,tT@1=127i8,t#2=32767i16,\"t$3\"=2147483647i32,t%4=9223372036854775807i64,t^5=11.12345f32,t&6=22.123456789f64,t*7=\"ddzhiksj\",t!@#$%^&*()_+[];:<>?,9=L\"ncharTagValue\" C)0=True,c{1=127i8,c[2=32767i16,c;3=2147483647i32,c:4=9223372036854775807i64,c<5=11.12345f32,c>6=22.123456789f64,c?7=\"bnhwlgvj\",c.8=L\"ncharTagValue\",c!@#$%^&*()_+[];:<>?,=7u64 1626006933640000000'
self._conn.schemaless_insert([input_sql], TDSmlProtocolType.LINE.value, TDSmlTimestampType.NANO_SECOND.value)
query_sql = 'select * from `rfa$sta`'
......@@ -1222,6 +1263,7 @@ class TDTestCase:
"""
thread input different stb
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql = self.genSqlList()[0]
self.multiThreadRun(self.genMultiThreadSeq(input_sql))
......@@ -1232,6 +1274,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1249,6 +1292,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, add columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1266,6 +1310,7 @@ class TDTestCase:
"""
thread input same stb tb, different data, minus columes and tags, result keep first data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1283,6 +1328,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -1295,6 +1341,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -1312,6 +1359,7 @@ class TDTestCase:
"""
thread input same stb, different tb, different data, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -1324,6 +1372,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1345,6 +1394,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1364,6 +1414,7 @@ class TDTestCase:
"""
thread input same stb tb, different ts, add tag, mul col
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
tb_name = tdCom.getLongName(7, "letters")
input_sql, stb_name = self.genFullTypeSql(tb_name=tb_name)
......@@ -1390,6 +1441,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -1402,6 +1454,7 @@ class TDTestCase:
"""
thread input same stb, different tb, data, ts, add col, mul tag
"""
tdLog.info(f'{sys._getframe().f_code.co_name}() function is running')
tdCom.cleanTb()
input_sql, stb_name = self.genFullTypeSql()
self.resCmp(input_sql, stb_name)
......@@ -1470,34 +1523,22 @@ class TDTestCase:
self.sStbStbDdataAtcInsertMultiThreadCheckCase()
self.sStbStbDdataMtcInsertMultiThreadCheckCase()
self.sStbDtbDdataInsertMultiThreadCheckCase()
# ! concurrency conflict
self.sStbDtbDdataAcMtInsertMultiThreadCheckCase()
self.sStbDtbDdataAtMcInsertMultiThreadCheckCase()
self.sStbStbDdataDtsInsertMultiThreadCheckCase()
# ! concurrency conflict
self.sStbStbDdataDtsAcMtInsertMultiThreadCheckCase()
self.sStbStbDdataDtsAtMcInsertMultiThreadCheckCase()
self.sStbDtbDdataDtsInsertMultiThreadCheckCase()
# ! concurrency conflict
self.sStbDtbDdataDtsAcMtInsertMultiThreadCheckCase()
def run(self):
print("running {}".format(__file__))
self.createDb()
try:
# self.tbnameTagsColsNameCheckCase()
# self.influxTsCheckCase()
self.runAll()
except Exception as err:
print(''.join(traceback.format_exception(None, err, err.__traceback__)))
raise err
# self.tagColIllegalValueCheckCase()
# self.test()
def stop(self):
tdSql.close()
......
###################################################################
# Copyright (c) 2021 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 time
import taos
conn = taos.connect()
stb_name = "test_crash"
conn.execute("use test")
conn.execute(f"select * from {stb_name}")
time.sleep(4)
conn.execute(f"select * from {stb_name}")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册