diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 2cd5d0a4a8..3ea8273e7f 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -577,6 +577,20 @@ class TMQCom: tdLog.info(tsql.queryResult) tdLog.info("wait subscriptions exit for %d s"%wait_cnt) + def killProcesser(self, processerName): + killCmd = ( + "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" + % processerName + ) + + psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % processerName + processID = subprocess.check_output(psCmd, shell=True) + + while processID: + os.system(killCmd) + time.sleep(1) + processID = subprocess.check_output(psCmd, shell=True) + 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 9da11c25cb..786d9a6e91 100644 --- a/tests/system-test/7-tmq/tmqDropConsumer.py +++ b/tests/system-test/7-tmq/tmqDropConsumer.py @@ -235,28 +235,28 @@ class TDTestCase: if (0 == existFlag): groupIdList.append(groupId) - # # kill taosBenchmark - # os.system("pkill -9 taosBenchmark") + # kill taosBenchmark + tmqCom.killProcesser("taosBenchmark") - # # wait the status to "lost" - # while (1): - # exitFlag = 1 - # tdSql.query('show consumers;') - # consumerNUm = tdSql.queryRows - # for i in range(consumerNUm): - # status = tdSql.getData(i,3) - # if (status != "lost"): - # exitFlag = 0 - # time.sleep(2) - # break - # if (1 == exitFlag): - # break + # wait the status to "lost" + while (1): + exitFlag = 1 + tdSql.query('show consumers;') + consumerNUm = tdSql.queryRows + for i in range(consumerNUm): + status = tdSql.getData(i,3) + if (status != "lost"): + exitFlag = 0 + time.sleep(2) + break + if (1 == exitFlag): + break - # # drop consumer groups - # for i in range(len(groupIdList)): - # for j in range(len(topicNameList)): - # sqlCmd = f"drop consumer group `%s` on %s"%(groupIdList[i], topicNameList[j]) - # tdSql.execute(sqlCmd) + # drop consumer groups + for i in range(len(groupIdList)): + for j in range(len(topicNameList)): + sqlCmd = f"drop consumer group `%s` on %s"%(groupIdList[i], topicNameList[j]) + tdSql.execute(sqlCmd) tmqCom.g_end_insert_flag = 1 tdLog.debug("notify sub-thread to stop insert data")