未验证 提交 475fa75e 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #20984 from taosdata/test/main/TS-3209

test:add testcase of compatibility.py for TS-3209
drop database if exists d0;
create database d0 replica 1 keep 365 minRows 100 maxRows 4096 comp 2 vgroups 2 precision 'ms';
use d0;
create table if not exists almlog (starttime timestamp,endtime timestamp,durationtime int, alarmno int, alarmtext nchar(256),isactive nchar(64)) tags (mcid nchar(16));
create table if not exists mplog (starttime timestamp,mpid int, paravalue nchar(256),mptype nchar(32)) tags (mcid nchar(16));
create table if not exists mdlog (starttime timestamp,endtime timestamp,durationtime int, statuscode int, npcgmname nchar(256),attr int) tags (mcid nchar(16));
create table if not exists nrglog (updatetime timestamp,energyvalue double,enerygyincrease double) tags (mcid nchar(16),enerygytype nchar(16));
create table almlog_m201 using almlog tags("m201");
create table almlog_m0103 using almlog tags("m0103");
create table almlog_m0103_20031 using almlog tags("m0103");
create table almlog_m0103_20032 using almlog tags("m0103");
create table almlog_m0103_3003 using almlog tags("m0103");
create table almlog_m0103_20033 using almlog tags("m0103");
create table almlog_m0103_30031 using almlog tags("m0103");
create table almlog_m0201 using almlog tags("m0201");
create table almlog_m0102 using almlog tags("m0102");
create table almlog_m0101 using almlog tags("m0101");
create table almlog_m1002 using almlog tags("m1002");
create table mplog_m0204_4 using mplog tags("m0204");
create table mplog_m0204_5 using mplog tags("m0204");
create table mplog_m0204_6 using mplog tags("m0204");
create table mplog_m0204_12 using mplog tags("m0204");
create table mplog_m0204 using mplog tags("m0204");
create table mplog_m201 using mplog tags("m201");
create table mplog_m0102 using mplog tags("m0102");
create table mplog_m1101 using mplog tags("m1101");
create table mdlog_m0102 using mplog tags("m0102");
create table mdlog_m0504 using mplog tags("m0504");
create table mdlog_m0505 using mplog tags("m0505");
create table mdlog_m0507 using mplog tags("m0507");
create table mdlog_m1002 using mplog tags("m1002");
create table mdlog_m3201 using mplog tags("m3201");
create table mdlog_m0201 using mplog tags("m0201");
create table mdlog_m1102 using mplog tags("m1102");
create table mdlog_m201 using mplog tags("m201");
create table nrglog_m201_electricvalue1 using nrglog tags("m201","electricValue1");
create table nrglog_m201_oilvalue1 using nrglog tags("m201","oilValue1");
create table nrglog_m201_gasvalue1 using nrglog tags("m201","gasValue1");
create table nrglog_m201_watervalue1 using nrglog tags("m201","waterValue1");
create table nrglog_m0101_oilvalue1 using nrglog tags("m0101","oilValue1");
create table nrglog_m0101_watervalue1 using nrglog tags("m0101","waterValue1");
create table nrglog_m0102_gasvalue1 using nrglog tags("m0102","gasValue1");
create table nrglog_m1903 using nrglog tags("m1903",NULL);
create table nrglog_m2802 using nrglog tags("m2802",NULL);
create table nrglog_m2101 using nrglog tags("m2101",NULL);
create table nrglog_m0102 using nrglog tags("m0102",NULL);
create table nrglog_m0101_electricvalue1 using nrglog tags("m0101","electricValue1");
create table nrglog_m0101_gasvalue1 using nrglog tags("m0101","gasValue1");
create table nrglog_m0102_electricvalue1 using nrglog tags("m0102","electricValue1");
create table nrglog_m0102_oilvalue1 using nrglog tags("m0102","oilValue1");
create table nrglog_m0102_watervalue1 using nrglog tags("m0102","waterValue1");
insert into almlog_m0103 values(now,now+1s,10,0,'','dismissed');
insert into almlog_m0103_20031 values(now,now+1s,10,20031,'','dismissed');
insert into almlog_m0103_20032 values(now,now+1s,10,20032,'','dismissed');
insert into almlog_m0103_3003 values(now,now+1s,10,3003,'','dismissed');
insert into almlog_m0103_20033 values(now,now+1s,10,20033,'','dismissed');
insert into almlog_m0103_30031 values(now,now+1s,10,30031,'','dismissed');
flush database d0;
show table tags from almlog;
select *,tbname from d0.almlog where mcid='m0103';
select table_name from information_schema.ins_tables where db_name='d0';
......@@ -53,18 +53,8 @@
"sample_format": "csv",
"sample_file": "./sample.csv",
"tags_file": "",
"columns": [
{
"type": "INT",
"count": 4094
}
],
"tags": [
{
"type": "TINYINT",
"count": 1
}
]
"columns": [{ "type": "INT","count": 4093}],
"tags": [{"type": "TINYINT", "count": 1},{"type": "NCHAR","count": 1}]
}
]
}
......
......@@ -98,9 +98,12 @@ class TDTestCase:
def buildTaosd(self,bPath):
# os.system(f"mv {bPath}/build_bak {bPath}/build ")
os.system(f" cd {bPath} ")
os.system(f" cd {bPath} ")
def is_list_same_as_ordered_list(self,unordered_list, ordered_list):
sorted_list = sorted(unordered_list)
return sorted_list == ordered_list
def run(self):
scriptsPath = os.path.dirname(os.path.realpath(__file__))
distro_id = distro.id()
......@@ -146,6 +149,8 @@ class TDTestCase:
tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ")
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y")
os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '")
os.system("LD_LIBRARY_PATH=/usr/lib taos -f 0-others/TS-3131.tsql")
cmd = f" LD_LIBRARY_PATH={bPath}/build/lib {bPath}/build/bin/taos -h localhost ;"
if os.system(cmd) == 0:
raise Exception("failed to execute system command. cmd: %s" % cmd)
......@@ -220,6 +225,17 @@ class TDTestCase:
tdLog.exit("%s(%d) failed" % args)
tdsql.query("show streams;")
tdsql.checkRows(2)
tdsql.query("select *,tbname from d0.almlog where mcid='m0103';")
tdsql.checkRows(6)
expectList = [0,3003,20031,20032,20033,30031]
resultList = []
for i in range(6):
resultList.append(tdsql.queryResult[i][3])
print(resultList)
if self.is_list_same_as_ordered_list(resultList,expectList):
print("The unordered list is the same as the ordered list.")
else:
tdlog.error("The unordered list is not the same as the ordered list.")
tdsql.execute("insert into test.d80 values (now+1s, 11, 103, 0.21);")
tdsql.execute("insert into test.d9 values (now+5s, 4.3, 104, 0.4);")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册