From 48b23f735cf9b095bbeb8357e5c8a8c1f6e25480 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 21 Aug 2023 15:28:29 +0800 Subject: [PATCH] test:kill tmq_sim process when start cases in windows --- tests/pytest/util/dnodes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index 89e3df81b9..8633fc660f 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -812,6 +812,15 @@ class TDDnodes: time.sleep(1) processID = subprocess.check_output( psCmd, shell=True).decode("utf-8").strip() + psCmd = "for /f %a in ('wmic process where \"name='tmq_sim'\" get processId ^| xargs echo ^| awk '{print $2}' ^&^& echo aa') do @(ps | grep %a | awk '{print $1}' | xargs)" + processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip() + while(processID): + print(processID) + killCmd = "kill -9 %s > nul 2>&1" % processID + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output( + psCmd, shell=True).decode("utf-8").strip() else: psCmd = "ps -ef | grep -w taosd | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}' | xargs" processID = subprocess.check_output(psCmd, shell=True).decode("utf-8").strip()