test: confirm that the process has been stopped successfully
This commit is contained in:
parent
e4064c3ddd
commit
c7bbfc9465
|
@ -88,24 +88,29 @@ class TDTestCase:
|
||||||
pid = 0
|
pid = 0
|
||||||
return pid
|
return pid
|
||||||
|
|
||||||
def checkAndstopPro(self,processName,startAction):
|
def checkAndstopPro(self, processName, startAction, count = 10):
|
||||||
i = 1
|
|
||||||
count = 10
|
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
taosdPid=self.get_process_pid(processName)
|
taosdPid=self.get_process_pid(processName)
|
||||||
|
print("taosdPid:",taosdPid)
|
||||||
if taosdPid != 0 and taosdPid != "" :
|
if taosdPid != 0 and taosdPid != "" :
|
||||||
tdLog.info("stop taosd %s ,kill pid :%s "%(startAction,taosdPid))
|
tdLog.info("stop taosd %s ,kill pid :%s "%(startAction,taosdPid))
|
||||||
os.system("kill -9 %d"%taosdPid)
|
for j in range(count):
|
||||||
break
|
os.system("kill -9 %d"%taosdPid)
|
||||||
|
taosdPid=self.get_process_pid(processName)
|
||||||
|
print("taosdPid2:",taosdPid)
|
||||||
|
if taosdPid == 0 or taosdPid == "" :
|
||||||
|
tdLog.info("taosd %s is stoped "%startAction)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
tdLog.info( "wait start taosd ,times: %d "%i)
|
tdLog.info( "wait start taosd ,times: %d "%i)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
i+= 1
|
|
||||||
else :
|
else :
|
||||||
tdLog.exit("taosd %s is not running "%startAction)
|
tdLog.exit("taosd %s is not running "%startAction)
|
||||||
|
|
||||||
|
|
||||||
def taosdCommandStop(self,startAction,taosdCmdRun):
|
def taosdCommandStop(self,startAction,taosdCmdRun):
|
||||||
processName="taosd"
|
processName= "taosd"
|
||||||
|
count = 10
|
||||||
if platform.system().lower() == 'windows':
|
if platform.system().lower() == 'windows':
|
||||||
processName="taosd.exe"
|
processName="taosd.exe"
|
||||||
taosdCmd = taosdCmdRun + startAction
|
taosdCmd = taosdCmdRun + startAction
|
||||||
|
@ -116,7 +121,7 @@ class TDTestCase:
|
||||||
else:
|
else:
|
||||||
logTime=datetime.now().strftime('%Y%m%d_%H%M%S_%f')
|
logTime=datetime.now().strftime('%Y%m%d_%H%M%S_%f')
|
||||||
os.system(f"nohup {taosdCmd} > {logTime}.log 2>&1 & ")
|
os.system(f"nohup {taosdCmd} > {logTime}.log 2>&1 & ")
|
||||||
self.checkAndstopPro(processName,startAction)
|
self.checkAndstopPro(processName,startAction,count)
|
||||||
os.system(f"rm -rf {logTime}.log")
|
os.system(f"rm -rf {logTime}.log")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue