From cf4da465e1dc70422e09002d2f644dadee72dcec Mon Sep 17 00:00:00 2001 From: kailixu Date: Wed, 16 Aug 2023 22:43:01 +0800 Subject: [PATCH] chore: add startProcess for tmq common --- tests/system-test/7-tmq/tmqCommon.py | 8 ++++++++ tests/system-test/7-tmq/tmqDropConsumer.py | 7 +------ tests/system-test/7-tmq/tmqMaxGroupIds.py | 4 +--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index c1583be009..7f972d857e 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -604,6 +604,14 @@ class TMQCom: except Exception as err: processID = "" print('**** warn: ', err) + + def startProcess(self, processName, param): + if platform.system().lower() == 'windows': + cmd = f"mintty -h never %s %s > NUL 2>&1" % (processName, param) + else: + cmd = f"nohup %s %s > /dev/null 2>&1 &" % (processName, param) + tdLog.info("%s"%(cmd)) + os.system(cmd) def close(self): self.cursor.close() diff --git a/tests/system-test/7-tmq/tmqDropConsumer.py b/tests/system-test/7-tmq/tmqDropConsumer.py index 0f8cffa595..137b5c6584 100644 --- a/tests/system-test/7-tmq/tmqDropConsumer.py +++ b/tests/system-test/7-tmq/tmqDropConsumer.py @@ -176,12 +176,7 @@ class TDTestCase: # use taosBenchmark to subscribe binPath = self.getPath() - if platform.system().lower() == 'windows': - cmd = f"mintty -h never %s -f ./7-tmq/tmqDropConsumer.json > NUL 2>&1" % binPath - else: - cmd = f"nohup %s -f ./7-tmq/tmqDropConsumer.json > /dev/null 2>&1 & " % binPath - tdLog.info("%s"%(cmd)) - os.system(cmd) + tmqCom.startProcess(binPath, "-f ./7-tmq/tmqDropConsumer.json") expectTopicNum = len(topicNameList) consumerThreadNum = 2 diff --git a/tests/system-test/7-tmq/tmqMaxGroupIds.py b/tests/system-test/7-tmq/tmqMaxGroupIds.py index d22b79a44c..75e2993a5b 100644 --- a/tests/system-test/7-tmq/tmqMaxGroupIds.py +++ b/tests/system-test/7-tmq/tmqMaxGroupIds.py @@ -176,9 +176,7 @@ class TDTestCase: # use taosBenchmark to subscribe binPath = self.getPath() - cmd = "nohup %s -f ./7-tmq/tmqMaxGroupIds.json > /dev/null 2>&1 & " % binPath - tdLog.info("%s"%(cmd)) - os.system(cmd) + tmqCom.startProcess(binPath, "-f ./7-tmq/tmqMaxGroupIds.json") expectTopicNum = 1 expectConsumerNUm = 99