test: finish testcase for TD-19847

This commit is contained in:
jiajingbin 2022-10-26 16:34:52 +08:00
parent 4fa215927f
commit e2ce0726d6
1 changed files with 23 additions and 1 deletions

View File

@ -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,7 +30,9 @@ 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 = {
'ts': 'timestamp',
'col1': 'tinyint', 'col1': 'tinyint',
'col2': 'smallint', 'col2': 'smallint',
'col3': 'int', 'col3': 'int',
@ -47,6 +48,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 +257,24 @@ 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):
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,self.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):