未验证 提交 81bd91f9 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19121 from taosdata/test/TD-21435-main

test: add test cases
......@@ -153,6 +153,8 @@ class TDTestCase:
tdSql.query("select count(*) from db.`stb4-2`")
tdSql.checkData(0, 0, 160)
tAdapter.stop()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -321,6 +321,7 @@ class TDTestCase:
tdSql.query("select count(*) from db.stb where t13 like 'b1%' or t13 like 'b2%'")
tdSql.checkData(0, 0, 160)
tAdapter.stop()
def stop(self):
tdSql.close()
......
......@@ -116,7 +116,7 @@ class TDTestCase:
assert times == 1, "result is %s != expect: 1" % times
tAdapter.stop()
def stop(self):
......
......@@ -482,8 +482,8 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/countAlwaysReturnValue.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/db.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/db.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/db.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/db.py -N 3 -n 3 -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/diff.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/diff.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py
......
......@@ -227,7 +227,7 @@ class TAdapter:
time.sleep(0.1)
def stop(self, force_kill=False):
signal = "-SIGKILL" if force_kill else "-SIGTERM"
signal = "-9" if force_kill else "-15"
if self.remoteIP:
self.remote_exec(self.taosadapter_cfg_dict, "tAdapter.running=1\ntAdapter.stop()")
......@@ -235,19 +235,17 @@ class TAdapter:
return
toBeKilled = "taosadapter"
if self.running != 0:
psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'"
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
# psCmd = f"pgrep {toBeKilled}"
processID = subprocess.check_output(
psCmd, shell=True)
while(processID):
killCmd = f"pkill {signal} {processID} > /dev/null "
killCmd = "kill %s %s > /dev/null 2>&1" % (signal, processID)
os.system(killCmd)
time.sleep(1)
processID = subprocess.check_output(
psCmd, shell=True).decode("utf-8")
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
if not platform.system().lower() == 'windows':
port = 6041
fuserCmd = f"fuser -k -n tcp {port} > /dev/null"
......
......@@ -42,16 +42,35 @@ class TDTestCase:
tdSql.query("select count(c1) from dbns.ntb interval(1b)")
tdSql.checkRows(2)
def case2(self):
tdSql.query("show variables")
tdSql.checkRows(4)
for i in range(self.replicaVar):
tdSql.query("show dnode %d variables like 'debugFlag'" % (i + 1))
tdSql.checkRows(1)
tdSql.checkData(0, 0, i + 1)
tdSql.checkData(0, 1, 'debugFlag')
tdSql.checkData(0, 2, 0)
tdSql.query("show dnode 1 variables like '%debugFlag'")
tdSql.checkRows(21)
tdSql.query("show dnode 1 variables like '____debugFlag'")
tdSql.checkRows(2)
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql.prepare()
tdSql.prepare(replica = self.replicaVar)
tdLog.printNoPrefix("==========start case1 run ...............")
self.case1()
tdLog.printNoPrefix("==========end case1 run ...............")
tdLog.printNoPrefix("==========start case2 run ...............")
self.case2()
tdLog.printNoPrefix("==========end case2 run ...............")
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册