未验证 提交 7081ad49 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #17674 from taosdata/test/td-19847

test: finish testcase for TD-19847
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import random import random
import string
from datetime import datetime from datetime import datetime
from util import constant from util import constant
from util.log import * from util.log import *
...@@ -31,6 +30,7 @@ class TDTestCase: ...@@ -31,6 +30,7 @@ class TDTestCase:
self.ctbname = 'ctb' self.ctbname = 'ctb'
self.ts = 1537146000000 self.ts = 1537146000000
self.str_length = 20 self.str_length = 20
self.block_update_times = 10000
self.column_dict = { self.column_dict = {
'col1': 'tinyint', 'col1': 'tinyint',
'col2': 'smallint', 'col2': 'smallint',
...@@ -47,6 +47,14 @@ class TDTestCase: ...@@ -47,6 +47,14 @@ class TDTestCase:
'col13': f'nchar({self.str_length})', 'col13': f'nchar({self.str_length})',
'col_ts' : 'timestamp' 'col_ts' : 'timestamp'
} }
self.tag_dict = {
't0':'int'
}
# The number of tag_values should be same as tbnum
self.tag_values = [
f'10',
f'100'
]
def data_check(self,tbname,col_name,col_type,value): def data_check(self,tbname,col_name,col_type,value):
tdSql.query(f'select {col_name} from {tbname}') tdSql.query(f'select {col_name} from {tbname}')
...@@ -248,11 +256,26 @@ class TDTestCase: ...@@ -248,11 +256,26 @@ class TDTestCase:
self.error_check(self.ntbname,self.column_dict,'ntb') self.error_check(self.ntbname,self.column_dict,'ntb')
self.error_check(self.ctbname,self.column_dict,'ctb',self.stbname) self.error_check(self.ctbname,self.column_dict,'ctb',self.stbname)
def update_10000times_and_query(self):
new_column_dict = {"ts": "timestamp"}
new_column_dict.update(self.column_dict)
tdSql.execute(f'drop database if exists {self.dbname}')
tdSql.execute(f'create database {self.dbname}')
tdSql.execute(f'use {self.dbname}')
tdSql.execute(self.setsql.set_create_stable_sql(self.stbname,new_column_dict,self.tag_dict))
tdSql.execute(f'create table {self.stbname}_1 using {self.stbname} tags({self.tag_values[0]})')
tdSql.execute(f'insert into {self.stbname}_1 values ({self.ts}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.choice(["True", "FALSE"])}, {random.randint(1, 127)}, {random.randint(1, 127)}, now)')
for i in range(self.block_update_times):
tdSql.execute(f'insert into {self.stbname}_1 values ({self.ts}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.randint(1, 127)}, {random.choice(["True", "FALSE"])}, {random.randint(1, 127)}, {random.randint(1, 127)}, now)')
tdSql.query(f'select count(*) from {self.stbname}')
tdSql.query(f'select * from {self.stbname}')
def run(self): def run(self):
#!bug TD-17708 and TD-17709 #!bug TD-17708 and TD-17709
# for i in range(10): # for i in range(10):
self.update_check() self.update_check()
self.update_check_error() self.update_check_error()
self.update_10000times_and_query()
# i+=1 # i+=1
def stop(self): def stop(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册