提交 e2ce0726 编写于 作者: J jiajingbin

test: finish testcase for TD-19847

上级 4fa21592
......@@ -12,7 +12,6 @@
# -*- coding: utf-8 -*-
import random
import string
from datetime import datetime
from util import constant
from util.log import *
......@@ -31,7 +30,9 @@ class TDTestCase:
self.ctbname = 'ctb'
self.ts = 1537146000000
self.str_length = 20
self.block_update_times = 10000
self.column_dict = {
'ts': 'timestamp',
'col1': 'tinyint',
'col2': 'smallint',
'col3': 'int',
......@@ -47,6 +48,14 @@ class TDTestCase:
'col13': f'nchar({self.str_length})',
'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):
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.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):
#!bug TD-17708 and TD-17709
# for i in range(10):
self.update_check()
self.update_check_error()
self.update_10000times_and_query()
# i+=1
def stop(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册