未验证 提交 5503ec72 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #19072 from taosdata/test/TD-21435

test: update script to stop taosadapter service
......@@ -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__)
......
......@@ -320,7 +320,8 @@ class TDTestCase:
tdSql.checkData(0, 0, 160)
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,11 +116,11 @@ class TDTestCase:
assert times == 1, "result is %s != expect: 1" % times
tAdapter.stop()
def stop(self):
tdSql.close()
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -480,8 +480,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()")
......@@ -238,16 +238,13 @@ class TAdapter:
if self.running != 0:
psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'"
# psCmd = f"pgrep {toBeKilled}"
processID = subprocess.check_output(
psCmd, shell=True)
while(processID):
killCmd = f"pkill {signal} {processID} > /dev/null "
# psCmd = f"pgrep {toBeKilled}"
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
while(processID):
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,36 @@ 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.
先完成此消息的编辑!
想要评论请 注册