Merge pull request #27970 from taosdata/td-32059
add ci test case for td-32059, td-31880, td-31966, td-32051 by charles
This commit is contained in:
commit
a49c7a84eb
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,44 @@
|
|||
import taos
|
||||
import socket
|
||||
from frame.log import *
|
||||
from frame.cases import *
|
||||
from frame.sql import *
|
||||
from frame.caseBase import *
|
||||
from frame import *
|
||||
from frame.eos import *
|
||||
from frame.server.dnodes import *
|
||||
|
||||
|
||||
class TDTestCase(TBase):
|
||||
"""Add test case to cover having key word
|
||||
"""
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), logSql)
|
||||
|
||||
def prepare_data(self):
|
||||
# data for TD-32059
|
||||
tdSql.execute("create database td32059;")
|
||||
tdSql.execute("use td32059;")
|
||||
tdSql.execute("create stable stb (ts timestamp, id int, gid int) tags (t1 int);")
|
||||
tdSql.execute("insert into tb1 using stb (t1) tags (1) values ('2024-09-11 09:53:13.999', 6, 6)('2024-09-11 09:53:15.005', 6, 6)('2024-09-11 09:53:15.402', 6, 6);")
|
||||
tdSql.execute("insert into tb2 using stb (t1) tags(2) values ('2024-09-11 09:54:59.790', 9, 9)('2024-09-11 09:55:58.978', 11, 11)('2024-09-11 09:56:22.755', 12, 12)('2024-09-11 09:56:23.276', 12, 12)('2024-09-11 09:56:23.783', 12, 12)('2024-09-11 09:56:26.783', 12, 12)('2024-09-11 09:56:29.783', 12, 12);")
|
||||
|
||||
def test_td32059(self):
|
||||
tdSql.execute("use td32059;")
|
||||
tdSql.query("SELECT _wstart, last_row(id) FROM stb WHERE ts BETWEEN '2024-09-11 09:50:13.999' AND '2024-09-11 09:59:13.999' INTERVAL(30s) FILL(PREV) HAVING(last_row(id) IS NOT NULL);")
|
||||
tdSql.checkRows(13)
|
||||
assert ('NULL' not in [item[1] for item in tdSql.res])
|
||||
|
||||
def run(self):
|
||||
self.prepare_data()
|
||||
self.test_td32059()
|
||||
|
||||
def stop(self):
|
||||
tdSql.execute("drop database td32059;")
|
||||
tdSql.close()
|
||||
tdLog.success("%s successfully executed" % __file__)
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -51,6 +51,22 @@ class TDTestCase(TBase):
|
|||
sql += f"({start_ts + i * 1000 * 1000 + j * 1000}, {','.join([str(item) for item in data[index[i]]])}),"
|
||||
sql += ";"
|
||||
tdSql.execute(sql)
|
||||
|
||||
# database for case TD-31880
|
||||
tdSql.execute("create database db_td31880;")
|
||||
tdSql.execute("use db_td31880;")
|
||||
# super table
|
||||
# tdSql.execute("create table st (ts timestamp, c1 int) tags(t1 int);")
|
||||
tdSql.execute("create stable if not exists db_td31880.stb (ts timestamp, c1 timestamp, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 int unsigned, c9 bigint unsigned, c10 float, c11 double, c12 varchar(64), c13 varbinary(64), c14 nchar(64), c15 geometry(64), c16 bool) tags (t1 timestamp, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 tinyint unsigned, t7 smallint unsigned, t8 int unsigned, t9 bigint unsigned, t10 float, t11 double, t12 varchar(64), t13 varbinary(64), t14 nchar(64), t15 geometry(64), t16 bool);")
|
||||
csv_file = os.sep.join([os.path.dirname(__file__), "create_table_by_csv_0627_5.csv"])
|
||||
tdSql.execute(f"insert into db_td31880.stb (ts,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,tbname) file '{csv_file}';")
|
||||
|
||||
# database for case TD-31966
|
||||
tdSql.execute("create database db_td31966;")
|
||||
tdSql.execute("use db_td31966;")
|
||||
tdSql.execute("create table tb1 (ts timestamp, c1 int, c2 int);")
|
||||
sql = "insert into tb1 values ('2024-09-09 11:41:00', 1, 1)('2024-09-09 11:41:01', 1, 100)('2024-09-09 11:41:02', 2, 1)('2024-09-09 11:41:11', 2, 2)('2024-09-09 11:41:12', 2, 100)"
|
||||
tdSql.execute(sql)
|
||||
|
||||
def test_ts4806(self):
|
||||
tdSql.execute("use db_ts4806;")
|
||||
|
@ -64,9 +80,53 @@ class TDTestCase(TBase):
|
|||
tdSql.checkData(4, 1, '30000002')
|
||||
tdSql.checkData(4, 2, 1001)
|
||||
|
||||
def test_td31880(self):
|
||||
tdSql.execute("use db_td31880;")
|
||||
tdSql.query("select last_row(ts) from stb group by tbname;")
|
||||
tdSql.checkRows(5000)
|
||||
|
||||
def test_td31966(self):
|
||||
tdSql.execute("use db_td31966;")
|
||||
tdSql.error("select percentile(c2,20) from tb1 count_window(2);")
|
||||
tdSql.error("select percentile(c2,20) from tb1 event_window start with f1 = 1 end with f1 > 1;")
|
||||
# percentile min for time window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 interval(5s) sliding(3s);")
|
||||
tdSql.checkRows(4)
|
||||
tdSql.checkData(0, 2, 1)
|
||||
tdSql.checkData(1, 2, 1)
|
||||
tdSql.checkData(2, 2, 2)
|
||||
tdSql.checkData(3, 2, 100)
|
||||
# percentile max for time window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 interval(5s) sliding(3s);")
|
||||
tdSql.checkRows(4)
|
||||
tdSql.checkData(0, 2, 100)
|
||||
tdSql.checkData(1, 2, 100)
|
||||
tdSql.checkData(2, 2, 100)
|
||||
tdSql.checkData(3, 2, 100)
|
||||
# percentile min for state window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 state_window(1);")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 2, 1)
|
||||
# percentile max for state window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 state_window(1);")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 2, 100)
|
||||
# percentile min for session window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,0) from tb1 session(ts, 3s);")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 2, 1)
|
||||
tdSql.checkData(1, 2, 2)
|
||||
# percentile max for session window
|
||||
tdSql.query("select _wstart, _wend, percentile(c2,100) from tb1 session(ts, 3s);")
|
||||
tdSql.checkRows(2)
|
||||
tdSql.checkData(0, 2, 100)
|
||||
tdSql.checkData(1, 2, 100)
|
||||
|
||||
def run(self):
|
||||
self.prepare_data()
|
||||
self.test_ts4806()
|
||||
self.test_td31880()
|
||||
self.test_td31966()
|
||||
|
||||
def stop(self):
|
||||
tdSql.execute("drop database db_ts4806;")
|
||||
|
|
|
@ -48,6 +48,15 @@ class TDTestCase(TBase):
|
|||
tdSql.execute("insert into ct3 values ('2021-01-01 00:00:01', 'b', NULL);")
|
||||
tdSql.execute("insert into ct4 values ('2021-01-01 00:00:00', 'c', '3');")
|
||||
tdSql.execute("insert into ct4 values ('2021-01-01 00:00:01', 'd', NULL);")
|
||||
|
||||
# TD-32051
|
||||
tdSql.execute("drop database if exists db32051;")
|
||||
tdSql.execute("create database db32051 replica 1 vgroups 1 cachemodel 'none';")
|
||||
tdSql.execute("use db32051;")
|
||||
tdSql.execute("create table ntb1(ts timestamp, kval int primary key, ival int);")
|
||||
tdSql.execute("insert into ntb1 values('2024-09-14 10:08:00.8', 3, 3);")
|
||||
tdSql.execute("flush database db32051;")
|
||||
tdSql.execute("insert into ntb1 values('2024-09-14 10:08:00.8', 1, 1);")
|
||||
|
||||
def test_last_with_primarykey_int_ct(self):
|
||||
tdSql.execute("use db_td30816;")
|
||||
|
@ -187,6 +196,14 @@ class TDTestCase(TBase):
|
|||
tdSql.query("select distinct site,zone,tracker,last(reg_firmware_rev) from trackers where ts > now() -1h and site='MI-01' partition by site;")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
def test_td32051(self):
|
||||
tdSql.execute("use db32051;")
|
||||
tdSql.execute("alter database db32051 cachemodel 'both';")
|
||||
time.sleep(5)
|
||||
tdSql.query("select last(ival) from db32051.ntb1;")
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkData(0, 0, 3)
|
||||
|
||||
def run(self):
|
||||
self.prepare_data()
|
||||
# regular table
|
||||
|
@ -197,6 +214,8 @@ class TDTestCase(TBase):
|
|||
self.test_last_with_primarykey_str_ct()
|
||||
# ts-5389
|
||||
self.test_ts5389()
|
||||
# TD-32051
|
||||
self.test_td32051()
|
||||
|
||||
def stop(self):
|
||||
tdSql.execute("drop database db_td30816;")
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
,,y,army,./pytest.sh python3 ./test.py -f query/query_basic.py -N 3
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_query_accuracy.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_ts5400.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f query/accuracy/test_having.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f insert/insert_basic.py -N 3
|
||||
,,y,army,./pytest.sh python3 ./test.py -f cluster/splitVgroupByLearner.py -N 3
|
||||
,,y,army,./pytest.sh python3 ./test.py -f authorith/authBasic.py -N 3
|
||||
|
|
Loading…
Reference in New Issue