test: refactor cases
This commit is contained in:
parent
597d239c4a
commit
bcb39e29fb
|
@ -28,8 +28,8 @@ from util.common import *
|
||||||
from util.constant import *
|
from util.constant import *
|
||||||
from dataclasses import dataclass,field
|
from dataclasses import dataclass,field
|
||||||
from typing import List
|
from typing import List
|
||||||
from datetime import datetime
|
from datetime import datetime, timedelta
|
||||||
import re
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class DataSet:
|
class DataSet:
|
||||||
ts_data : List[int] = field(default_factory=list)
|
ts_data : List[int] = field(default_factory=list)
|
||||||
|
@ -1797,6 +1797,18 @@ class TDCom:
|
||||||
self.sdelete_rows(tbname=self.ctb_name, start_ts=self.time_cast(self.record_history_ts, "-"))
|
self.sdelete_rows(tbname=self.ctb_name, start_ts=self.time_cast(self.record_history_ts, "-"))
|
||||||
self.sdelete_rows(tbname=self.tb_name, start_ts=self.time_cast(self.record_history_ts, "-"))
|
self.sdelete_rows(tbname=self.tb_name, start_ts=self.time_cast(self.record_history_ts, "-"))
|
||||||
|
|
||||||
|
def get_timestamp_30_days_later(self):
|
||||||
|
"""
|
||||||
|
Get the timestamp for a date 30 days later than the current date.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
float: The timestamp for the date 30 days later.
|
||||||
|
"""
|
||||||
|
now = datetime.now()
|
||||||
|
thirty_days_later = now + timedelta(days=30)
|
||||||
|
timestamp_thirty_days_later = thirty_days_later.timestamp()
|
||||||
|
return int(timestamp_thirty_days_later*1000)
|
||||||
|
|
||||||
def prepare_data(self, interval=None, watermark=None, session=None, state_window=None, state_window_max=127, interation=3, range_count=None, precision="ms", fill_history_value=0, ext_stb=None, custom_col_index=None, col_value_type="random"):
|
def prepare_data(self, interval=None, watermark=None, session=None, state_window=None, state_window_max=127, interation=3, range_count=None, precision="ms", fill_history_value=0, ext_stb=None, custom_col_index=None, col_value_type="random"):
|
||||||
"""prepare stream data
|
"""prepare stream data
|
||||||
|
|
||||||
|
@ -1827,7 +1839,7 @@ class TDCom:
|
||||||
"state_window_max": state_window_max,
|
"state_window_max": state_window_max,
|
||||||
"iteration": interation,
|
"iteration": interation,
|
||||||
"range_count": range_count,
|
"range_count": range_count,
|
||||||
"start_ts": 1655903478508,
|
"start_ts": self.get_timestamp_30_days_later(),
|
||||||
}
|
}
|
||||||
if range_count is not None:
|
if range_count is not None:
|
||||||
self.range_count = range_count
|
self.range_count = range_count
|
||||||
|
|
|
@ -95,7 +95,7 @@ class TDTestCase:
|
||||||
if partition == "c1":
|
if partition == "c1":
|
||||||
if subtable:
|
if subtable:
|
||||||
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{c1_value[1]}{self.tdCom.subtable_suffix}')
|
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{c1_value[1]}{self.tdCom.subtable_suffix}')
|
||||||
tdSql.query(f'select count(*) from `{tbname}`')
|
tdSql.query(f'select count(*) from `{tbname}`', count_expected_res=1)
|
||||||
else:
|
else:
|
||||||
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{partition_elm_alias}{self.tdCom.subtable_suffix}')
|
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{partition_elm_alias}{self.tdCom.subtable_suffix}')
|
||||||
tdSql.query(f'select count(*) from `{tbname}`')
|
tdSql.query(f'select count(*) from `{tbname}`')
|
||||||
|
@ -103,7 +103,7 @@ class TDTestCase:
|
||||||
elif partition == "abs(c1)":
|
elif partition == "abs(c1)":
|
||||||
abs_c1_value = abs(c1_value[1])
|
abs_c1_value = abs(c1_value[1])
|
||||||
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}')
|
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{abs_c1_value}{self.tdCom.subtable_suffix}')
|
||||||
tdSql.query(f'select count(*) from `{tbname}`')
|
tdSql.query(f'select count(*) from `{tbname}`', count_expected_res=1)
|
||||||
elif partition == "tbname" and ptn_counter == 0:
|
elif partition == "tbname" and ptn_counter == 0:
|
||||||
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}')
|
tbname = self.tdCom.get_subtable_wait(f'{self.ctb_name}_{self.tdCom.subtable_prefix}{self.ctb_name}{self.tdCom.subtable_suffix}')
|
||||||
tdSql.query(f'select count(*) from `{tbname}`')
|
tdSql.query(f'select count(*) from `{tbname}`')
|
||||||
|
|
Loading…
Reference in New Issue