test: update script to stop taosadapter service
This commit is contained in:
parent
4b7eb1e637
commit
889872c24d
|
@ -153,6 +153,8 @@ class TDTestCase:
|
||||||
tdSql.query("select count(*) from db.`stb4-2`")
|
tdSql.query("select count(*) from db.`stb4-2`")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
|
tAdapter.stop()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
|
@ -320,7 +320,8 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
tdSql.query("select count(*) from db.stb where t13 like 'b1%' or t13 like 'b2%'")
|
tdSql.query("select count(*) from db.stb where t13 like 'b1%' or t13 like 'b2%'")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
|
tAdapter.stop()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
|
@ -116,11 +116,11 @@ class TDTestCase:
|
||||||
|
|
||||||
assert times == 1, "result is %s != expect: 1" % times
|
assert times == 1, "result is %s != expect: 1" % times
|
||||||
|
|
||||||
|
tAdapter.stop()
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,7 @@ class TAdapter:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
def stop(self, force_kill=False):
|
def stop(self, force_kill=False):
|
||||||
signal = "-SIGKILL" if force_kill else "-SIGTERM"
|
signal = "-9" if force_kill else "-15"
|
||||||
|
|
||||||
if self.remoteIP:
|
if self.remoteIP:
|
||||||
self.remote_exec(self.taosadapter_cfg_dict, "tAdapter.running=1\ntAdapter.stop()")
|
self.remote_exec(self.taosadapter_cfg_dict, "tAdapter.running=1\ntAdapter.stop()")
|
||||||
|
@ -238,16 +238,13 @@ class TAdapter:
|
||||||
|
|
||||||
if self.running != 0:
|
if self.running != 0:
|
||||||
psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'"
|
psCmd = f"ps -ef|grep -w {toBeKilled}| grep -v grep | awk '{{print $2}}'"
|
||||||
# psCmd = f"pgrep {toBeKilled}"
|
# psCmd = f"pgrep {toBeKilled}"
|
||||||
processID = subprocess.check_output(
|
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
|
||||||
psCmd, shell=True)
|
while(processID):
|
||||||
|
killCmd = "kill %s %s > /dev/null 2>&1" % (signal, processID)
|
||||||
while(processID):
|
|
||||||
killCmd = f"pkill {signal} {processID} > /dev/null "
|
|
||||||
os.system(killCmd)
|
os.system(killCmd)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
processID = subprocess.check_output(
|
processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()
|
||||||
psCmd, shell=True).decode("utf-8")
|
|
||||||
if not platform.system().lower() == 'windows':
|
if not platform.system().lower() == 'windows':
|
||||||
port = 6041
|
port = 6041
|
||||||
fuserCmd = f"fuser -k -n tcp {port} > /dev/null"
|
fuserCmd = f"fuser -k -n tcp {port} > /dev/null"
|
||||||
|
|
|
@ -42,16 +42,32 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query("select count(c1) from dbns.ntb interval(1b)")
|
tdSql.query("select count(c1) from dbns.ntb interval(1b)")
|
||||||
tdSql.checkRows(2)
|
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.execute("alter dnode 2 'debugFlag 135'")
|
||||||
|
|
||||||
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||||
tdSql.prepare()
|
tdSql.prepare(replica = self.replicaVar)
|
||||||
|
|
||||||
|
|
||||||
tdLog.printNoPrefix("==========start case1 run ...............")
|
tdLog.printNoPrefix("==========start case1 run ...............")
|
||||||
|
|
||||||
self.case1()
|
self.case1()
|
||||||
|
|
||||||
tdLog.printNoPrefix("==========end case1 run ...............")
|
tdLog.printNoPrefix("==========end case1 run ...............")
|
||||||
|
|
||||||
|
tdLog.printNoPrefix("==========start case2 run ...............")
|
||||||
|
self.case2()
|
||||||
|
tdLog.printNoPrefix("==========end case2 run ...............")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
Loading…
Reference in New Issue