未验证 提交 8a0fc4a6 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #15932 from taosdata/test/vnode_case_update

test: update vnode case
......@@ -30,7 +30,7 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def diff_query_form(self, col="c1", alias="", table_expr="t1", condition=""):
def diff_query_form(self, col="c1", alias="", table_expr="db.t1", condition=""):
'''
diff function:
......@@ -44,7 +44,7 @@ class TDTestCase:
return f"select diff({col}) {alias} from {table_expr} {condition}"
def checkdiff(self,col="c1", alias="", table_expr="t1", condition="" ):
def checkdiff(self,col="c1", alias="", table_expr="db.t1", condition="" ):
line = sys._getframe().f_back.f_lineno
pre_sql = self.diff_query_form(
col=col, table_expr=table_expr, condition=condition
......@@ -60,7 +60,7 @@ class TDTestCase:
return
if "order by tbname" in condition:
tdSql.error(self.diff_query_form(
tdSql.query(self.diff_query_form(
col=col, alias=alias, table_expr=table_expr, condition=condition
))
return
......@@ -164,9 +164,9 @@ class TDTestCase:
self.checkdiff(**case6)
# case7~8: nested query
# case7 = {"table_expr": "(select c1 from stb1)"}
# case7 = {"table_expr": "(select c1 from db.stb1)"}
# self.checkdiff(**case7)
# case8 = {"table_expr": "(select diff(c1) c1 from stb1 group by tbname)"}
# case8 = {"table_expr": "(select diff(c1) c1 from db.stb1 group by tbname)"}
# self.checkdiff(**case8)
# case9~10: mix with tbname/ts/tag/col
......@@ -200,15 +200,15 @@ class TDTestCase:
self.checkdiff(**case17)
# case18~19: with group by
# case18 = {
# "table_expr": "t1",
# "table_expr": "db.t1",
# "condition": "group by c6"
# }
# self.checkdiff(**case18)
# case19 = {
# "table_expr": "stb1",
# "condition": "partition by tbname" # partition by tbname
# }
# self.checkdiff(**case19)
case19 = {
"table_expr": "db.stb1",
"condition": "partition by tbname order by tbname" # partition by tbname
}
self.checkdiff(**case19)
# # case20~21: with order by
# case20 = {"condition": "order by ts"}
......@@ -226,7 +226,7 @@ class TDTestCase:
}
self.checkdiff(**case23)
# case24 = {
# "table_expr": "stb1",
# "table_expr": "db.stb1",
# "condition": "group by tbname slimit 1 soffset 1"
# }
# self.checkdiff(**case24)
......@@ -241,13 +241,13 @@ class TDTestCase:
#
# form test
tdSql.error(self.diff_query_form(col="")) # no col
tdSql.error("diff(c1) from stb1") # no select
tdSql.error("select diff from t1") # no diff condition
tdSql.error("select diff c1 from t1") # no brackets
tdSql.error("select diff(c1) t1") # no from
tdSql.error("diff(c1) from db.stb1") # no select
tdSql.error("select diff from db.t1") # no diff condition
tdSql.error("select diff c1 from db.t1") # no brackets
tdSql.error("select diff(c1) db.t1") # no from
tdSql.error("select diff( c1 ) from ") # no table_expr
# tdSql.error(self.diff_query_form(col="st1")) # tag col
tdSql.query("select diff(st1) from t1 ")
tdSql.query("select diff(st1) from db.t1")
# tdSql.error(self.diff_query_form(col=1)) # col is a value
tdSql.error(self.diff_query_form(col="'c1'")) # col is a string
tdSql.error(self.diff_query_form(col=None)) # col is NULL 1
......@@ -258,18 +258,18 @@ class TDTestCase:
tdSql.error(self.diff_query_form(col='c.')) # col is spercial char 3
tdSql.error(self.diff_query_form(col='avg(c1)')) # expr col
# tdSql.error(self.diff_query_form(col='c6')) # bool col
tdSql.query("select diff(c6) from t1")
tdSql.query("select diff(c6) from db.t1")
tdSql.error(self.diff_query_form(col='c4')) # binary col
tdSql.error(self.diff_query_form(col='c10')) # nachr col
tdSql.error(self.diff_query_form(col='c10')) # not table_expr col
tdSql.error(self.diff_query_form(col='t1')) # tbname
tdSql.error(self.diff_query_form(col='stb1')) # stbname
tdSql.error(self.diff_query_form(col='db.t1')) # tbname
tdSql.error(self.diff_query_form(col='db.stb1')) # stbname
tdSql.error(self.diff_query_form(col='db')) # datbasename
# tdSql.error(self.diff_query_form(col=True)) # col is BOOL 1
# tdSql.error(self.diff_query_form(col='True')) # col is BOOL 2
tdSql.error(self.diff_query_form(col='*')) # col is all col
tdSql.error("select diff[c1] from t1") # sql form error 1
tdSql.error("select diff{c1} from t1") # sql form error 2
tdSql.error("select diff[c1] from db.t1") # sql form error 1
tdSql.error("select diff{c1} from db.t1") # sql form error 2
tdSql.error(self.diff_query_form(col="[c1]")) # sql form error 3
# tdSql.error(self.diff_query_form(col="c1, c2")) # sql form error 3
# tdSql.error(self.diff_query_form(col="c1, 2")) # sql form error 3
......@@ -282,7 +282,7 @@ class TDTestCase:
# tdSql.error(self.diff_query_form(alias=" + 2")) # mix with arithmetic 1
tdSql.error(self.diff_query_form(alias=" + avg(c1)")) # mix with arithmetic 2
tdSql.query(self.diff_query_form(alias=", c2")) # mix with other 1
# tdSql.error(self.diff_query_form(table_expr="stb1")) # select stb directly
# tdSql.error(self.diff_query_form(table_expr="db.stb1")) # select stb directly
stb_join = {
"col": "stb1.c1",
"table_expr": "stb1, stb2",
......@@ -294,17 +294,17 @@ class TDTestCase:
}
tdSql.error(self.diff_query_form(**interval_sql)) # interval
group_normal_col = {
"table_expr": "t1",
"table_expr": "db.t1",
"condition": "group by c6"
}
tdSql.error(self.diff_query_form(**group_normal_col)) # group by normal col
slimit_soffset_sql = {
"table_expr": "stb1",
"table_expr": "db.stb1",
"condition": "group by tbname slimit 1 soffset 1"
}
# tdSql.error(self.diff_query_form(**slimit_soffset_sql))
order_by_tbname_sql = {
"table_expr": "stb1",
"table_expr": "db.stb1",
"condition": "group by tbname order by tbname"
}
tdSql.error(self.diff_query_form(**order_by_tbname_sql))
......@@ -349,63 +349,40 @@ class TDTestCase:
"create stable db.stb2 (ts timestamp, c1 int) tags(st2 int)"
)
for i in range(tbnum):
tdSql.execute(f"create table t{i} using stb1 tags({i})")
tdSql.execute(f"create table tt{i} using stb2 tags({i})")
tdSql.execute(f"create table t{i} using db.stb1 tags({i})")
tdSql.execute(f"create table tt{i} using db.stb2 tags({i})")
pass
def diff_support_stable(self):
tdSql.query(" select diff(1) from stb1 ")
tdSql.query(" select diff(1) from db.stb1 ")
tdSql.checkRows(229)
tdSql.checkData(0,0,0)
tdSql.query("select diff(c1) from stb1 partition by tbname ")
tdSql.query("select diff(c1) from db.stb1 partition by tbname ")
tdSql.checkRows(190)
# tdSql.query("select diff(st1) from stb1 partition by tbname")
# tdSql.checkRows(229)
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.query("select diff(st1+c1) from db.stb1 partition by tbname")
tdSql.checkRows(190)
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.query("select diff(st1+c1) from db.stb1 partition by tbname")
tdSql.checkRows(190)
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.query("select diff(st1+c1) from db.stb1 partition by tbname")
tdSql.checkRows(190)
# # bug need fix
# tdSql.query("select diff(st1+c1) from stb1 partition by tbname slimit 1 ")
# tdSql.checkRows(19)
# tdSql.error("select diff(st1+c1) from stb1 partition by tbname limit 1 ")
# bug need fix
tdSql.query("select diff(st1+c1) from stb1 partition by tbname")
tdSql.query("select diff(st1+c1) from db.stb1 partition by tbname")
tdSql.checkRows(190)
# bug need fix
# tdSql.query("select tbname , diff(c1) from stb1 partition by tbname")
# tdSql.checkRows(199)
# tdSql.query("select tbname , diff(st1) from stb1 partition by tbname")
# tdSql.checkRows(199)
# tdSql.query("select tbname , diff(st1) from stb1 partition by tbname slimit 1")
# tdSql.checkRows(19)
tdSql.query("select tbname , diff(c1) from db.stb1 partition by tbname")
tdSql.checkRows(190)
tdSql.query("select tbname , diff(st1) from db.stb1 partition by tbname")
tdSql.checkRows(220)
# partition by tags
# tdSql.query("select st1 , diff(c1) from stb1 partition by st1")
# tdSql.checkRows(199)
# tdSql.query("select diff(c1) from stb1 partition by st1")
# tdSql.checkRows(199)
# tdSql.query("select st1 , diff(c1) from stb1 partition by st1 slimit 1")
# tdSql.checkRows(19)
# tdSql.query("select diff(c1) from stb1 partition by st1 slimit 1")
# tdSql.checkRows(19)
# partition by col
# tdSql.query("select c1 , diff(c1) from stb1 partition by c1")
# tdSql.checkRows(199)
# tdSql.query("select diff(c1) from stb1 partition by c1")
# tdSql.checkRows(41)
# tdSql.query("select c1 , diff(c1) from stb1 partition by st1 slimit 1")
# tdSql.checkRows(19)
# tdSql.query("select diff(c1) from stb1 partition by st1 slimit 1")
# tdSql.checkRows(19)
# partition by tags
tdSql.query("select st1 , diff(c1) from db.stb1 partition by st1")
tdSql.checkRows(190)
tdSql.query("select diff(c1) from db.stb1 partition by st1")
tdSql.checkRows(190)
def diff_test_run(self) :
......@@ -428,18 +405,18 @@ class TDTestCase:
tdLog.printNoPrefix("######## insert data in the range near the max(bigint/double):")
self.diff_test_table(tbnum)
tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {2**31-1}, {3.4*10**38}, {1.7*10**308}, {2**63-1})")
self.diff_current_query()
self.diff_error_query()
tdLog.printNoPrefix("######## insert data in the range near the min(bigint/double):")
self.diff_test_table(tbnum)
tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 1) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {1-2**63})")
tdSql.execute(f"insert into t1(ts, c1,c2,c5,c7) values "
tdSql.execute(f"insert into db.t1(ts, c1,c2,c5,c7) values "
f"({nowtime - (per_table_rows + 2) * 10}, {1-2**31}, {-3.4*10**38}, {-1.7*10**308}, {512-2**63})")
self.diff_current_query()
self.diff_error_query()
......
......@@ -270,7 +270,7 @@ class TDTestCase:
if not vote_act:
print("=======before_revote_leader_infos ======\n" , before_leader_infos)
print("=======after_revote_leader_infos ======\n" , after_leader_infos)
tdLog.exit(" ===maybe revote not occured , there is no dnode offline ====")
tdLog.info(" ===maybe revote not occured , there is no dnode offline ====")
else:
for vgroup_info in vote_act:
for ind , role in enumerate(vgroup_info):
......
......@@ -215,7 +215,7 @@ python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_query
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync_force_stop.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_follower_unsync.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader_forece_stop.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py -N 4 -M 1
python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_stop_leader.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_mnode3_insertdatas_querys.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower_force_stop.py -N 4 -M 1
# python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_querydatas_stop_follower.py -N 4 -M 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册