test:modify test case
This commit is contained in:
parent
7af4b2c584
commit
7797027da2
|
@ -11,6 +11,8 @@ from util.log import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.dnodes import *
|
from util.dnodes import *
|
||||||
|
sys.path.append("./7-tmq")
|
||||||
|
from tmqCommon import *
|
||||||
|
|
||||||
class actionType(Enum):
|
class actionType(Enum):
|
||||||
CREATE_DATABASE = 0
|
CREATE_DATABASE = 0
|
||||||
|
@ -193,32 +195,41 @@ class TDTestCase:
|
||||||
and restart a consumption process to complete a consumption
|
and restart a consumption process to complete a consumption
|
||||||
'''
|
'''
|
||||||
tdLog.printNoPrefix("======== test case 1: ")
|
tdLog.printNoPrefix("======== test case 1: ")
|
||||||
|
tmqCom.initConsumerTable()
|
||||||
|
|
||||||
self.initConsumerTable()
|
#self.initConsumerTable()
|
||||||
|
|
||||||
# create and start thread
|
# create and start thread
|
||||||
parameterDict = {'cfg': '', \
|
paraDict = {'dbName': 'dbt',
|
||||||
'actionType': 0, \
|
'dropFlag': 1,
|
||||||
'dbName': 'db3', \
|
'event': '',
|
||||||
'dropFlag': 1, \
|
'vgroups': 4,
|
||||||
'vgroups': 4, \
|
'stbName': 'stb',
|
||||||
'replica': 1, \
|
'colPrefix': 'c',
|
||||||
'stbName': 'stb1', \
|
'tagPrefix': 't',
|
||||||
'ctbNum': 10, \
|
'colSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1},{'type': 'TIMESTAMP', 'count':1}],
|
||||||
'rowsPerTbl': 20000, \
|
'tagSchema': [{'type': 'INT', 'count':1},{'type': 'BIGINT', 'count':1},{'type': 'DOUBLE', 'count':1},{'type': 'BINARY', 'len':32, 'count':1},{'type': 'NCHAR', 'len':32, 'count':1}],
|
||||||
'batchNum': 100, \
|
'ctbPrefix': 'ctb',
|
||||||
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
|
'ctbStartIdx': 0,
|
||||||
parameterDict['cfg'] = cfgPath
|
'ctbNum': 10,
|
||||||
|
'rowsPerTbl': 20000,
|
||||||
|
'batchNum': 1000,
|
||||||
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
|
'pollDelay': 30,
|
||||||
|
'showMsg': 1,
|
||||||
|
'showRow': 1,
|
||||||
|
'snapshot': 0}
|
||||||
|
paraDict['cfg'] = cfgPath
|
||||||
|
|
||||||
self.create_database(tdSql, parameterDict["dbName"])
|
self.create_database(tdSql, paraDict["dbName"])
|
||||||
self.create_stable(tdSql, parameterDict["dbName"], parameterDict["stbName"])
|
self.create_stable(tdSql, paraDict["dbName"], paraDict["stbName"])
|
||||||
self.create_ctables(tdSql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbNum"])
|
self.create_ctables(tdSql, paraDict["dbName"], paraDict["stbName"], paraDict["ctbNum"])
|
||||||
self.insert_data(tdSql,parameterDict["dbName"],parameterDict["stbName"],parameterDict["ctbNum"],parameterDict["rowsPerTbl"],parameterDict["batchNum"])
|
self.insert_data(tdSql,paraDict["dbName"],paraDict["stbName"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"])
|
||||||
|
|
||||||
tdLog.info("create topics from stb1")
|
tdLog.info("create topics from stb1")
|
||||||
topicFromStb1 = 'topic_stb1'
|
topicFromStb1 = 'topic_stb1'
|
||||||
|
|
||||||
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName']))
|
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, paraDict['dbName'], paraDict['stbName']))
|
||||||
consumerId = 0
|
consumerId = 0
|
||||||
# expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"]
|
# expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"]
|
||||||
expectrowcnt = 90000000000
|
expectrowcnt = 90000000000
|
||||||
|
@ -229,13 +240,16 @@ class TDTestCase:
|
||||||
enable.auto.commit:false,\
|
enable.auto.commit:false,\
|
||||||
auto.commit.interval.ms:6000,\
|
auto.commit.interval.ms:6000,\
|
||||||
auto.offset.reset:earliest'
|
auto.offset.reset:earliest'
|
||||||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
#self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor")
|
tdLog.info("start consume processor")
|
||||||
pollDelay = 9000000 # Forever loop
|
pollDelay = 9000000 # Forever loop
|
||||||
showMsg = 1
|
showMsg = 1
|
||||||
showRow = 1
|
showRow = 1
|
||||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
#self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
||||||
|
tdLog.info("start consume processor")
|
||||||
|
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||||
|
|
||||||
#time.sleep(3)
|
#time.sleep(3)
|
||||||
tmqCom.getStartConsumeNotifyFromTmqsim()
|
tmqCom.getStartConsumeNotifyFromTmqsim()
|
||||||
|
@ -254,17 +268,17 @@ class TDTestCase:
|
||||||
######### redo to consume
|
######### redo to consume
|
||||||
self.initConsumerTable()
|
self.initConsumerTable()
|
||||||
|
|
||||||
self.create_database(tdSql, parameterDict["dbName"])
|
self.create_database(tdSql, paraDict["dbName"])
|
||||||
self.create_stable(tdSql, parameterDict["dbName"], parameterDict["stbName"])
|
self.create_stable(tdSql, paraDict["dbName"], paraDict["stbName"])
|
||||||
self.create_ctables(tdSql, parameterDict["dbName"], parameterDict["stbName"], parameterDict["ctbNum"])
|
self.create_ctables(tdSql, paraDict["dbName"], paraDict["stbName"], paraDict["ctbNum"])
|
||||||
self.insert_data(tdSql,parameterDict["dbName"],parameterDict["stbName"],parameterDict["ctbNum"],parameterDict["rowsPerTbl"],parameterDict["batchNum"])
|
self.insert_data(tdSql,paraDict["dbName"],paraDict["stbName"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"])
|
||||||
|
|
||||||
tdLog.info("create topics from stb1")
|
tdLog.info("create topics from stb1")
|
||||||
topicFromStb1 = 'topic_stb1'
|
topicFromStb1 = 'topic_stb1'
|
||||||
|
|
||||||
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, parameterDict['dbName'], parameterDict['stbName']))
|
tdSql.execute("create topic %s as select ts, c1, c2 from %s.%s" %(topicFromStb1, paraDict['dbName'], paraDict['stbName']))
|
||||||
consumerId = 0
|
consumerId = 0
|
||||||
expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"]
|
expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"]
|
||||||
topicList = topicFromStb1
|
topicList = topicFromStb1
|
||||||
ifcheckdata = 0
|
ifcheckdata = 0
|
||||||
ifManualCommit = 0
|
ifManualCommit = 0
|
||||||
|
@ -272,13 +286,17 @@ class TDTestCase:
|
||||||
enable.auto.commit:false,\
|
enable.auto.commit:false,\
|
||||||
auto.commit.interval.ms:6000,\
|
auto.commit.interval.ms:6000,\
|
||||||
auto.offset.reset:earliest'
|
auto.offset.reset:earliest'
|
||||||
self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
#self.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor")
|
tdLog.info("start consume processor")
|
||||||
pollDelay = 20
|
pollDelay = 20
|
||||||
showMsg = 1
|
showMsg = 1
|
||||||
showRow = 1
|
showRow = 1
|
||||||
self.startTmqSimProcess(buildPath,cfgPath,pollDelay,parameterDict["dbName"],showMsg, showRow)
|
paraDict['pollDelay'] = 20
|
||||||
|
#self.startTmqSimProcess(buildPath,cfgPath,pollDelay,paraDict["dbName"],showMsg, showRow)
|
||||||
|
tdLog.info("start consume processor")
|
||||||
|
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||||
|
|
||||||
expectRows = 1
|
expectRows = 1
|
||||||
resultList = self.selectConsumeResult(expectRows)
|
resultList = self.selectConsumeResult(expectRows)
|
||||||
|
|
Loading…
Reference in New Issue