未验证 提交 bc5f62e6 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #17906 from taosdata/lihui3.0/test

test:modify case
......@@ -16,8 +16,11 @@ from util.dnodes import TDDnodes
from util.dnodes import TDDnode
from util.cluster import *
from util.common import *
sys.path.append("./6-cluster")
sys.path.append("./7-tmq")
from tmqCommon import *
from clusterCommonCreate import *
from clusterCommonCheck import clusterComCheck
class TDTestCase:
def __init__(self):
......@@ -26,6 +29,7 @@ class TDTestCase:
self.vgroups = 4
self.ctbNum = 1000
self.rowsPerTbl = 100
self.dnodeNumbers = 5
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
......@@ -119,15 +123,19 @@ class TDTestCase:
tdLog.info("================= restart dnode 2===========================")
cluster.dnodes[1].stoptaosd()
cluster.dnodes[1].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 3===========================")
cluster.dnodes[2].stoptaosd()
cluster.dnodes[2].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 4===========================")
cluster.dnodes[3].stoptaosd()
cluster.dnodes[3].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 5===========================")
cluster.dnodes[4].stoptaosd()
cluster.dnodes[4].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
pThread.join()
# tdLog.info("restart taosd to ensure that the data falls into the disk")
......@@ -193,9 +201,9 @@ class TDTestCase:
tdSql.query(queryString)
totalRowsFromQuery = tdSql.getRows()
tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt))
tdLog.info("act consume rows: %d, act query rows: %d "%(totalConsumeRows, totalRowsFromQuery))
if totalConsumeRows != totalRowsFromQuery:
if totalConsumeRows < totalRowsFromQuery:
tdLog.exit("tmq consume rows error!")
# tmqCom.checkFileContent(consumerId, queryString)
......@@ -224,7 +232,7 @@ class TDTestCase:
'rowsPerTbl': 1000,
'batchNum': 100,
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
'pollDelay': 15,
'pollDelay': 30,
'showMsg': 1,
'showRow': 1,
'snapshot': 1}
......@@ -238,7 +246,10 @@ class TDTestCase:
queryString = "select ts, c1, c2 from %s.%s where t4 == 'beijing' or t4 == 'changsha' "%(paraDict['dbName'], paraDict['stbName'])
sqlString = "create topic %s as %s" %(topicFromStb1, queryString)
tdLog.info("create topic sql: %s"%sqlString)
tdSql.execute(sqlString)
tdSql.execute(sqlString)
tdSql.query(queryString)
totalRowsFromQuery = tdSql.getRows()
consumerId = 0
expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"]
......@@ -257,15 +268,19 @@ class TDTestCase:
tdLog.info("================= restart dnode 2===========================")
cluster.dnodes[1].stoptaosd()
cluster.dnodes[1].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 3===========================")
cluster.dnodes[2].stoptaosd()
cluster.dnodes[2].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 4===========================")
cluster.dnodes[3].stoptaosd()
cluster.dnodes[3].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("================= restart dnode 5===========================")
cluster.dnodes[4].stoptaosd()
cluster.dnodes[4].starttaosd()
clusterComCheck.checkDnodes(self.dnodeNumbers)
tdLog.info("start to check consume result")
expectRows = 1
......@@ -274,12 +289,9 @@ class TDTestCase:
for i in range(expectRows):
totalConsumeRows += resultList[i]
tdSql.query(queryString)
totalRowsFromQuery = tdSql.getRows()
tdLog.info("act consume rows: %d, act query rows: %d "%(totalConsumeRows, totalRowsFromQuery))
tdLog.info("act consume rows: %d, act query rows: %d, expect consume rows: %d, "%(totalConsumeRows, totalRowsFromQuery, expectrowcnt))
if totalConsumeRows != totalRowsFromQuery:
if totalConsumeRows < totalRowsFromQuery:
tdLog.exit("tmq consume rows error!")
# tmqCom.checkFileContent(consumerId, queryString)
......@@ -290,8 +302,8 @@ class TDTestCase:
tdLog.printNoPrefix("======== test case 2 end ...... ")
def run(self):
self.prepareTestEnv()
self.tmqCase1()
#self.prepareTestEnv()
#self.tmqCase1()
self.prepareTestEnv()
self.tmqCase2()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册