提交 16ccd095 编写于 作者: J jiacy-jcy

test:add test case into ci

上级 c4d59126
...@@ -30,8 +30,8 @@ class TDTestCase: ...@@ -30,8 +30,8 @@ class TDTestCase:
self.setsql = TDSetSql() self.setsql = TDSetSql()
self.stbname = 'stb' self.stbname = 'stb'
self.ntbname = 'ntb' self.ntbname = 'ntb'
self.rowNum = 5 self.rowNum = 10
self.tbnum = 2 self.tbnum = 3
self.ts = 1537146000000 self.ts = 1537146000000
self.binary_str = 'taosdata' self.binary_str = 'taosdata'
self.nchar_str = '涛思数据' self.nchar_str = '涛思数据'
...@@ -110,13 +110,22 @@ class TDTestCase: ...@@ -110,13 +110,22 @@ class TDTestCase:
tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['binary']}")''') tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['binary']}")''')
elif 'nchar' in col_type.lower(): elif 'nchar' in col_type.lower():
tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['nchar']}")''') tdSql.execute(f'''insert into {tbname} values({self.ts+i},"{base_data['nchar']}")''')
def delete_all_data(self,tbname,col_type,row_num,base_data,dbname,tb_type,tb_num=1): def delete_all_data(self,tbname,col_type,row_num,base_data,dbname,tb_type,tb_num=1,stbname=''):
tdSql.query(f'select count(*) from {tbname}')
tdSql.execute(f'delete from {tbname}') tdSql.execute(f'delete from {tbname}')
tdSql.execute(f'flush database {dbname}') tdSql.execute(f'flush database {dbname}')
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query(f'select * from {tbname}') tdSql.query(f'select * from {tbname}')
tdSql.checkRows(0) tdSql.checkRows(0)
if tb_type == 'ntb' or tb_type == 'ctb': if tb_type == 'ntb' or tb_type == 'ctb':
if tb_type == 'ctb':
tdSql.query(f'select count(*) from {stbname}')
if tb_num <= 1:
if len(tdSql.queryResult) != 0:
tdLog.exit('delete case failure!')
else:
tdSql.checkEqual(tdSql.queryResult[0][0],(tb_num-1)*row_num)
self.insert_base_data(col_type,tbname,row_num,base_data) self.insert_base_data(col_type,tbname,row_num,base_data)
elif tb_type == 'stb': elif tb_type == 'stb':
for i in range(tb_num): for i in range(tb_num):
...@@ -265,7 +274,7 @@ class TDTestCase: ...@@ -265,7 +274,7 @@ class TDTestCase:
tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags(1)') tdSql.execute(f'create table {self.stbname}_{i} using {self.stbname} tags(1)')
self.insert_base_data(col_type,f'{self.stbname}_{i}',self.rowNum,self.base_data) self.insert_base_data(col_type,f'{self.stbname}_{i}',self.rowNum,self.base_data)
self.delete_one_row(f'{self.stbname}_{i}',col_type,col_name,self.base_data,self.rowNum,self.dbname,'ctb') self.delete_one_row(f'{self.stbname}_{i}',col_type,col_name,self.base_data,self.rowNum,self.dbname,'ctb')
self.delete_all_data(f'{self.stbname}_{i}',col_type,self.rowNum,self.base_data,self.dbname,'ctb') self.delete_all_data(f'{self.stbname}_{i}',col_type,self.rowNum,self.base_data,self.dbname,'ctb',i+1,self.stbname)
self.delete_error(f'{self.stbname}_{i}',col_name,col_type,self.base_data) self.delete_error(f'{self.stbname}_{i}',col_name,col_type,self.base_data)
self.delete_rows(self.dbname,f'{self.stbname}_{i}',col_name,col_type,self.base_data,self.rowNum,'ctb') self.delete_rows(self.dbname,f'{self.stbname}_{i}',col_name,col_type,self.base_data,self.rowNum,'ctb')
for func in ['first','last']: for func in ['first','last']:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册