test: add tmq case
This commit is contained in:
parent
856912deda
commit
ecd39d33f5
|
@ -20,7 +20,7 @@ from tmqCommon import *
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.vgroups = 32
|
self.vgroups = 32
|
||||||
self.ctbNum = 15000
|
self.ctbNum = 100
|
||||||
self.rowsPerTbl = 1000
|
self.rowsPerTbl = 1000
|
||||||
self.snapshot = 1
|
self.snapshot = 1
|
||||||
self.replicaVar = 3
|
self.replicaVar = 3
|
||||||
|
@ -91,7 +91,7 @@ class TDTestCase:
|
||||||
'rowsPerTbl': 10000,
|
'rowsPerTbl': 10000,
|
||||||
'batchNum': 1000,
|
'batchNum': 1000,
|
||||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
'pollDelay': 10,
|
'pollDelay': 20,
|
||||||
'showMsg': 1,
|
'showMsg': 1,
|
||||||
'showRow': 1,
|
'showRow': 1,
|
||||||
'snapshot': 1}
|
'snapshot': 1}
|
||||||
|
@ -101,8 +101,7 @@ class TDTestCase:
|
||||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||||
paraDict['snapshot'] = self.snapshot
|
paraDict['snapshot'] = self.snapshot
|
||||||
|
|
||||||
topicNameList = ['topic1']
|
topicNameList = ['topic1', 'topic2']
|
||||||
expectRowsList = []
|
|
||||||
tmqCom.initConsumerTable()
|
tmqCom.initConsumerTable()
|
||||||
|
|
||||||
tdLog.info("create topics from stb with filter")
|
tdLog.info("create topics from stb with filter")
|
||||||
|
@ -112,14 +111,18 @@ class TDTestCase:
|
||||||
sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
|
sqlString = "create topic %s as %s" %(topicNameList[0], queryString)
|
||||||
tdLog.info("create topic sql: %s"%sqlString)
|
tdLog.info("create topic sql: %s"%sqlString)
|
||||||
tdSql.execute(sqlString)
|
tdSql.execute(sqlString)
|
||||||
tdSql.query(queryString)
|
|
||||||
expectRowsList.append(tdSql.getRows())
|
sqlString = "create topic %s as %s" %(topicNameList[1], queryString)
|
||||||
|
tdLog.info("create topic sql: %s"%sqlString)
|
||||||
|
tdSql.execute(sqlString)
|
||||||
|
# tdSql.query(queryString)
|
||||||
|
# expectRowsList.append(tdSql.getRows())
|
||||||
|
|
||||||
# init consume info, and start tmq_sim, then check consume result
|
# init consume info, and start tmq_sim, then check consume result
|
||||||
tdLog.info("insert consume info to consume processor")
|
tdLog.info("insert consume info to consume processor")
|
||||||
consumerId = 0
|
consumerId = 0
|
||||||
expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"]
|
expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 4
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0] + ',' + topicNameList[0] + ',' + topicNameList[1]
|
||||||
ifcheckdata = 0
|
ifcheckdata = 0
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
||||||
|
@ -137,16 +140,14 @@ class TDTestCase:
|
||||||
pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
|
pInsertThread = tmqCom.asyncInsertDataByInterlace(paraDict)
|
||||||
pInsertThread.join()
|
pInsertThread.join()
|
||||||
|
|
||||||
expectRowsList[0] = expectRowsList[0] * 2
|
|
||||||
|
|
||||||
expectRows = 2
|
expectRows = 2
|
||||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||||
actConsumeTotalRows = resultList[0] + resultList[1]
|
actConsumeTotalRows = resultList[0] + resultList[1]
|
||||||
|
|
||||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(actConsumeTotalRows, expectRowsList[0]))
|
tdLog.info("act consume rows: %d, expect consume rows: %d"%(actConsumeTotalRows, expectrowcnt))
|
||||||
|
|
||||||
if (expectRowsList[0] <= actConsumeTotalRows) or ((resultList[0] == 0) and (resultList[1] >= expectRowsList[0])) or ((resultList[1] == 0) and (resultList[0] >= expectRowsList[0])):
|
if not ((expectrowcnt <= actConsumeTotalRows) or ((resultList[0] == 0) and (resultList[1] >= expectrowcnt)) or ((resultList[1] == 0) and (resultList[0] >= expectrowcnt))):
|
||||||
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0]))
|
tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectrowcnt, actConsumeTotalRows))
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
# tmqCom.checkFileContent(consumerId, queryString)
|
# tmqCom.checkFileContent(consumerId, queryString)
|
||||||
|
|
Loading…
Reference in New Issue