提交 2cb14466 编写于 作者: C cpwu

fix case

上级 5b06d8df
...@@ -80,23 +80,18 @@ class DataSet: ...@@ -80,23 +80,18 @@ class DataSet:
self.bool_data.append( bool((i + bool_start) % 2 )) self.bool_data.append( bool((i + bool_start) % 2 ))
self.vchar_data.append( f"{vchar_prefix}_{i * vchar_step}" ) self.vchar_data.append( f"{vchar_prefix}_{i * vchar_step}" )
self.nchar_data.append( f"{nchar_prefix}_{i * nchar_step}") self.nchar_data.append( f"{nchar_prefix}_{i * nchar_step}")
self.ts_data.append( int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000 - i * ts_step)) self.ts_data.append( int(datetime.timestamp(datetime.now()) * 1000 - i * ts_step))
def get_disorder_set(self, def get_disorder_set(self, rows, **kwargs):
rows, for k, v in kwargs.items():
int_low :int = INT_MIN, int_low = v if k == "int_low" else INT_MIN
int_up :int = INT_MAX, int_up = v if k == "int_up" else INT_MAX
bint_low :int = BIGINT_MIN, bint_low = v if k == "bint_low" else BIGINT_MIN
bint_up :int = BIGINT_MAX, bint_up = v if k == "bint_up" else BIGINT_MAX
sint_low :int = SMALLINT_MIN, sint_low = v if k == "sint_low" else SMALLINT_MIN
sint_up :int = SMALLINT_MAX, sint_up = v if k == "sint_up" else SMALLINT_MAX
tint_low :int = TINYINT_MIN, tint_low = v if k == "tint_low" else TINYINT_MIN
tint_up :int = TINYINT_MAX, tint_up = v if k == "tint_up" else TINYINT_MAX
ubint_low :int = BIGINT_UN_MIN,
ubint_up :int = BIGINT_UN_MAX,
):
pass pass
......
...@@ -193,8 +193,9 @@ class TDTestCase: ...@@ -193,8 +193,9 @@ class TDTestCase:
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) tags ({INT_TAG} int) ) tags ({INT_TAG} int)
''' '''
for i in range(ntbnum): tdSql.execute(create_stb_sql)
for i in range(ntbnum):
create_ntb_sql = f'''create table {dbname}.{ntb_pre}{i+1}( create_ntb_sql = f'''create table {dbname}.{ntb_pre}{i+1}(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
...@@ -203,8 +204,7 @@ class TDTestCase: ...@@ -203,8 +204,7 @@ class TDTestCase:
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) )
''' '''
tdSql.execute(create_stb_sql) tdSql.execute(create_ntb_sql)
tdSql.execute(create_ntb_sql)
for i in range(ctb_num): for i in range(ctb_num):
tdSql.execute(f'create table {dbname}.{ctb_pre}{i+1} using {dbname}.{stb} tags ( {i+1} )') tdSql.execute(f'create table {dbname}.{ctb_pre}{i+1} using {dbname}.{stb} tags ( {i+1} )')
...@@ -213,9 +213,6 @@ class TDTestCase: ...@@ -213,9 +213,6 @@ class TDTestCase:
data = DataSet().get_order_set(rows) data = DataSet().get_order_set(rows)
tdLog.printNoPrefix("==========step: start inser data into tables now.....") tdLog.printNoPrefix("==========step: start inser data into tables now.....")
# now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
for i in range(self.rows): for i in range(self.rows):
row_data = f''' row_data = f'''
{data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]}, {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
...@@ -237,12 +234,10 @@ class TDTestCase: ...@@ -237,12 +234,10 @@ class TDTestCase:
tdSql.execute( tdSql.execute(
f"insert into {dbname}.{NTB_PRE}1 values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )") f"insert into {dbname}.{NTB_PRE}1 values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )")
def run(self): def run(self):
self.rows = 10 self.rows = 10
self.cfg_check() self.cfg_check()
tdSql.prepare(dbname=DBNAME, **{"keep": "5m, 10m, 15m", "duration":"5m"}) tdSql.prepare(dbname=DBNAME, **{"keep": "1d, 1500m, 26h", "duration":"1h"})
self.__create_tb(dbname=DBNAME) self.__create_tb(dbname=DBNAME)
self.__insert_data(rows=self.rows, dbname=DBNAME) self.__insert_data(rows=self.rows, dbname=DBNAME)
tdSql.query(f"select count(*) from {DBNAME}.{NTB_PRE}1") tdSql.query(f"select count(*) from {DBNAME}.{NTB_PRE}1")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册