fix test cases

This commit is contained in:
Ganlin Zhao 2022-07-30 11:33:39 +08:00
parent e231ec95ef
commit 8998435f70
6 changed files with 78 additions and 78 deletions

View File

@ -3,7 +3,7 @@ from numpy import row_stack
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -13,13 +13,13 @@ from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import clusterComCheck from clusterCommonCheck import clusterComCheck
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
import threading import threading
import time import time
import inspect import inspect
import ctypes import ctypes
@ -57,7 +57,7 @@ class TDTestCase:
if res == 0: if res == 0:
raise ValueError("invalid thread id") raise ValueError("invalid thread id")
elif res != 1: elif res != 1:
# """if it returns a number greater than one, you're in trouble, # """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect""" # and you should call it again with exc=NULL to revert the effect"""
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
raise SystemError("PyThreadState_SetAsyncExc failed") raise SystemError("PyThreadState_SetAsyncExc failed")
@ -68,7 +68,7 @@ class TDTestCase:
def insertData(self,countstart,countstop): def insertData(self,countstart,countstop):
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in range(countstart,countstop): for couti in range(countstart,countstop):
tdLog.debug("drop database if exists db%d" %couti) tdLog.debug("drop database if exists db%d" %couti)
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
@ -118,7 +118,7 @@ class TDTestCase:
rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"] rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"]
rowsall=rowsPerStb*paraDict['stbNumbers'] rowsall=rowsPerStb*paraDict['stbNumbers']
dbNumbers = 1 dbNumbers = 1
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -133,7 +133,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -142,7 +142,7 @@ class TDTestCase:
# create database and stable # create database and stable
clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])
tdLog.info("Take turns stopping Mnodes ") tdLog.info("Take turns stopping Mnodes ")
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
# dnode6=cluster.addDnode(6) # dnode6=cluster.addDnode(6)
@ -166,7 +166,7 @@ class TDTestCase:
newTdSql=tdCom.newTdSql() newTdSql=tdCom.newTdSql()
threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]))) threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"])))
for tr in threads: for tr in threads:
tr.start() tr.start()
dnode6Port=int(6030+5*100) dnode6Port=int(6030+5*100)
tdSql.execute("create dnode '%s:%d'"%(hostname,dnode6Port)) tdSql.execute("create dnode '%s:%d'"%(hostname,dnode6Port))
clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDnodes(dnodeNumbers)
@ -179,7 +179,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
elif stopRole == "vnode": elif stopRole == "vnode":
for i in range(vnodeNumbers): for i in range(vnodeNumbers):
tdDnodes[i+mnodeNums].stoptaosd() tdDnodes[i+mnodeNums].stoptaosd()
@ -191,20 +191,20 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
# dnodeNumbers don't include database of schema # dnodeNumbers don't include database of schema
if clusterComCheck.checkDnodes(dnodeNumbers): if clusterComCheck.checkDnodes(dnodeNumbers):
tdLog.info("123") tdLog.info("123")
else: else:
print("456") print("456")
self.stopThread(threads) self.stopThread(threads)
tdLog.exit("one or more of dnodes failed to start ") tdLog.exit("one or more of dnodes failed to start ")
# self.check3mnode() # self.check3mnode()
stopcount+=1 stopcount+=1
clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDnodes(dnodeNumbers)
clusterComCheck.checkDbRows(dbNumbers) clusterComCheck.checkDbRows(dbNumbers)
@ -217,7 +217,7 @@ class TDTestCase:
stableName= '%s_%d'%(paraDict['stbName'],i) stableName= '%s_%d'%(paraDict['stbName'],i)
tdSql.query("select * from %s"%stableName) tdSql.query("select * from %s"%stableName)
tdSql.checkRows(rowsPerStb) tdSql.checkRows(rowsPerStb)
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode')
@ -226,4 +226,4 @@ class TDTestCase:
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())

View File

@ -3,7 +3,7 @@ from numpy import row_stack
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -13,13 +13,13 @@ from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import clusterComCheck from clusterCommonCheck import clusterComCheck
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
import threading import threading
import time import time
import inspect import inspect
import ctypes import ctypes
@ -57,7 +57,7 @@ class TDTestCase:
if res == 0: if res == 0:
raise ValueError("invalid thread id") raise ValueError("invalid thread id")
elif res != 1: elif res != 1:
# """if it returns a number greater than one, you're in trouble, # """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect""" # and you should call it again with exc=NULL to revert the effect"""
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
raise SystemError("PyThreadState_SetAsyncExc failed") raise SystemError("PyThreadState_SetAsyncExc failed")
@ -68,7 +68,7 @@ class TDTestCase:
def insertData(self,countstart,countstop): def insertData(self,countstart,countstop):
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in range(countstart,countstop): for couti in range(countstart,countstop):
tdLog.debug("drop database if exists db%d" %couti) tdLog.debug("drop database if exists db%d" %couti)
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
@ -110,7 +110,7 @@ class TDTestCase:
"rowsPerTbl": 100, "rowsPerTbl": 100,
"batchNum": 5000 "batchNum": 5000
} }
dnodeNumbers=int(dnodeNumbers) dnodeNumbers=int(dnodeNumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
vnodeNumbers = int(dnodeNumbers-mnodeNums) vnodeNumbers = int(dnodeNumbers-mnodeNums)
@ -118,7 +118,7 @@ class TDTestCase:
rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"] rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"]
rowsall=rowsPerStb*paraDict['stbNumbers'] rowsall=rowsPerStb*paraDict['stbNumbers']
dbNumbers = 1 dbNumbers = 1
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -133,7 +133,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -142,7 +142,7 @@ class TDTestCase:
# create database and stable # create database and stable
clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])
tdLog.info("Take turns stopping Mnodes ") tdLog.info("Take turns stopping Mnodes ")
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
stopcount =0 stopcount =0
@ -173,7 +173,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
elif stopRole == "vnode": elif stopRole == "vnode":
for i in range(vnodeNumbers): for i in range(vnodeNumbers):
tdDnodes[i+mnodeNums].stoptaosd() tdDnodes[i+mnodeNums].stoptaosd()
@ -185,7 +185,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
# dnodeNumbers don't include database of schema # dnodeNumbers don't include database of schema
if clusterComCheck.checkDnodes(dnodeNumbers): if clusterComCheck.checkDnodes(dnodeNumbers):
@ -196,10 +196,10 @@ class TDTestCase:
tdLog.exit("one or more of dnodes failed to start ") tdLog.exit("one or more of dnodes failed to start ")
# self.check3mnode() # self.check3mnode()
stopcount+=1 stopcount+=1
for tr in threads: for tr in threads:
tr.join() tr.join()
clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDnodes(dnodeNumbers)
clusterComCheck.checkDbRows(dbNumbers) clusterComCheck.checkDbRows(dbNumbers)
# clusterComCheck.checkDb(dbNumbers,1,paraDict["dbName"]) # clusterComCheck.checkDb(dbNumbers,1,paraDict["dbName"])
@ -212,7 +212,7 @@ class TDTestCase:
# tdSql.query("select * from %s"%stableName) # tdSql.query("select * from %s"%stableName)
# tdSql.checkRows(rowsPerStb) # tdSql.checkRows(rowsPerStb)
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=1,stopRole='dnode') self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=1,stopRole='dnode')
@ -221,4 +221,4 @@ class TDTestCase:
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())

View File

@ -3,7 +3,7 @@ from numpy import row_stack
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -13,13 +13,13 @@ from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import clusterComCheck from clusterCommonCheck import clusterComCheck
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
import threading import threading
import time import time
import inspect import inspect
import ctypes import ctypes
@ -57,7 +57,7 @@ class TDTestCase:
if res == 0: if res == 0:
raise ValueError("invalid thread id") raise ValueError("invalid thread id")
elif res != 1: elif res != 1:
# """if it returns a number greater than one, you're in trouble, # """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect""" # and you should call it again with exc=NULL to revert the effect"""
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
raise SystemError("PyThreadState_SetAsyncExc failed") raise SystemError("PyThreadState_SetAsyncExc failed")
@ -68,7 +68,7 @@ class TDTestCase:
def insertData(self,countstart,countstop): def insertData(self,countstart,countstop):
# fisrt add data : db\stable\childtable\general table # fisrt add data : db\stable\childtable\general table
for couti in range(countstart,countstop): for couti in range(countstart,countstop):
tdLog.debug("drop database if exists db%d" %couti) tdLog.debug("drop database if exists db%d" %couti)
tdSql.execute("drop database if exists db%d" %couti) tdSql.execute("drop database if exists db%d" %couti)
@ -110,7 +110,7 @@ class TDTestCase:
"rowsPerTbl": 10000, "rowsPerTbl": 10000,
"batchNum": 5000 "batchNum": 5000
} }
dnodeNumbers=int(dnodeNumbers) dnodeNumbers=int(dnodeNumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
vnodeNumbers = int(dnodeNumbers-mnodeNums) vnodeNumbers = int(dnodeNumbers-mnodeNums)
@ -118,7 +118,7 @@ class TDTestCase:
rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"] rowsPerStb=paraDict["ctbNum"]*paraDict["rowsPerTbl"]
rowsall=rowsPerStb*paraDict['stbNumbers'] rowsall=rowsPerStb*paraDict['stbNumbers']
dbNumbers = 1 dbNumbers = 1
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -133,7 +133,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -142,7 +142,7 @@ class TDTestCase:
# create database and stable # create database and stable
clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])
tdLog.info("Take turns stopping Mnodes ") tdLog.info("Take turns stopping Mnodes ")
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
stopcount =0 stopcount =0
@ -171,7 +171,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
elif stopRole == "vnode": elif stopRole == "vnode":
for i in range(vnodeNumbers): for i in range(vnodeNumbers):
tdDnodes[i+mnodeNums].stoptaosd() tdDnodes[i+mnodeNums].stoptaosd()
@ -183,19 +183,19 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
# dnodeNumbers don't include database of schema # dnodeNumbers don't include database of schema
if clusterComCheck.checkDnodes(dnodeNumbers): if clusterComCheck.checkDnodes(dnodeNumbers):
tdLog.info("123") tdLog.info("123")
else: else:
print("456") print("456")
self.stopThread(threads) self.stopThread(threads)
tdLog.exit("one or more of dnodes failed to start ") tdLog.exit("one or more of dnodes failed to start ")
# self.check3mnode() # self.check3mnode()
stopcount+=1 stopcount+=1
for tr in threads: for tr in threads:
tr.join() tr.join()
clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDnodes(dnodeNumbers)
@ -209,7 +209,7 @@ class TDTestCase:
stableName= '%s_%d'%(paraDict['stbName'],i) stableName= '%s_%d'%(paraDict['stbName'],i)
tdSql.query("select * from %s"%stableName) tdSql.query("select * from %s"%stableName)
tdSql.checkRows(rowsPerStb) tdSql.checkRows(rowsPerStb)
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode')
@ -218,4 +218,4 @@ class TDTestCase:
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())

View File

@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -12,13 +12,13 @@ from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import clusterComCheck from clusterCommonCheck import clusterComCheck
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
import threading import threading
import time import time
import inspect import inspect
import ctypes import ctypes
@ -56,7 +56,7 @@ class TDTestCase:
if res == 0: if res == 0:
raise ValueError("invalid thread id") raise ValueError("invalid thread id")
elif res != 1: elif res != 1:
# """if it returns a number greater than one, you're in trouble, # """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect""" # and you should call it again with exc=NULL to revert the effect"""
ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)
raise SystemError("PyThreadState_SetAsyncExc failed") raise SystemError("PyThreadState_SetAsyncExc failed")
@ -82,13 +82,13 @@ class TDTestCase:
'ctbPrefix': 'ctb', 'ctbPrefix': 'ctb',
'ctbNum': 1, 'ctbNum': 1,
} }
dnodeNumbers=int(dnodeNumbers) dnodeNumbers=int(dnodeNumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
vnodeNumbers = int(dnodeNumbers-mnodeNums) vnodeNumbers = int(dnodeNumbers-mnodeNums)
allDbNumbers=(paraDict['dbNumbers']*restartNumbers) allDbNumbers=(paraDict['dbNumbers']*restartNumbers)
allStbNumbers=(paraDict['stbNumbers']*restartNumbers) allStbNumbers=(paraDict['stbNumbers']*restartNumbers)
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -103,7 +103,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -124,7 +124,7 @@ class TDTestCase:
for tr in threads: for tr in threads:
tr.start() tr.start()
tdLog.info("Take turns stopping Mnodes ") tdLog.info("Take turns stopping Mnodes ")
while stopcount < restartNumbers: while stopcount < restartNumbers:
tdLog.info(" restart loop: %d"%stopcount ) tdLog.info(" restart loop: %d"%stopcount )
if stopRole == "mnode": if stopRole == "mnode":
@ -132,7 +132,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
elif stopRole == "vnode": elif stopRole == "vnode":
for i in range(vnodeNumbers): for i in range(vnodeNumbers):
tdDnodes[i+mnodeNums].stoptaosd() tdDnodes[i+mnodeNums].stoptaosd()
@ -144,7 +144,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
# sleep(10) # sleep(10)
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
# sleep(10) # sleep(10)
# dnodeNumbers don't include database of schema # dnodeNumbers don't include database of schema
if clusterComCheck.checkDnodes(dnodeNumbers): if clusterComCheck.checkDnodes(dnodeNumbers):
@ -155,7 +155,7 @@ class TDTestCase:
tdLog.exit("one or more of dnodes failed to start ") tdLog.exit("one or more of dnodes failed to start ")
# self.check3mnode() # self.check3mnode()
stopcount+=1 stopcount+=1
for tr in threads: for tr in threads:
tr.join() tr.join()
clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDnodes(dnodeNumbers)
@ -169,7 +169,7 @@ class TDTestCase:
# clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) # clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i))
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=10,stopRole='vnode') self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=10,stopRole='vnode')
@ -178,4 +178,4 @@ class TDTestCase:
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())

View File

@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -15,13 +15,13 @@ from test import tdDnodes
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import * from clusterCommonCheck import *
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
class TDTestCase: class TDTestCase:
def init(self,conn ,logSql): def init(self,conn ,logSql):
@ -69,7 +69,7 @@ class TDTestCase:
dnodenumbers=int(dnodenumbers) dnodenumbers=int(dnodenumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
dbNumbers = int(dnodenumbers * restartNumber) dbNumbers = int(dnodenumbers * restartNumber)
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -84,7 +84,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -109,10 +109,10 @@ class TDTestCase:
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(dnodenumbers=5,mnodeNums=3,restartNumber=1) self.fiveDnodeThreeMnode(dnodenumbers=5,mnodeNums=3,restartNumber=1)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")

View File

@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import taos import taos
import sys import sys
import time import time
import os import os
from util.log import * from util.log import *
from util.sql import * from util.sql import *
@ -16,13 +16,13 @@ from test import tdDnodes
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import * from clusterCommonCheck import *
import time import time
import socket import socket
import subprocess import subprocess
from multiprocessing import Process from multiprocessing import Process
class TDTestCase: class TDTestCase:
def init(self,conn ,logSql): def init(self,conn ,logSql):
@ -69,7 +69,7 @@ class TDTestCase:
dnodenumbers=int(dnodenumbers) dnodenumbers=int(dnodenumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
dbNumbers = int(dnodenumbers * restartNumber) dbNumbers = int(dnodenumbers * restartNumber)
tdLog.info("first check dnode and mnode") tdLog.info("first check dnode and mnode")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(0,1,'%s:6030'%self.host)
@ -84,7 +84,7 @@ class TDTestCase:
tdSql.execute("create mnode on dnode 3") tdSql.execute("create mnode on dnode 3")
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
# add some error operations and # add some error operations and
tdLog.info("Confirm the status of the dnode again") tdLog.info("Confirm the status of the dnode again")
tdSql.error("create mnode on dnode 2") tdSql.error("create mnode on dnode 2")
tdSql.query("show dnodes;") tdSql.query("show dnodes;")
@ -96,21 +96,21 @@ class TDTestCase:
# restart all taosd # restart all taosd
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
for i in range(mnodeNums): for i in range(mnodeNums):
tdDnodes[i].stoptaosd() tdDnodes[i].stoptaosd()
for j in range(dnodenumbers): for j in range(dnodenumbers):
if j != i: if j != i:
cluster.checkConnectStatus(j) cluster.checkConnectStatus(j)
clusterComCheck.check3mnodeoff(i+1,3) clusterComCheck.check3mnodeoff(i+1,3)
clusterComCheck.init(cluster.checkConnectStatus(i+1)) clusterComCheck.init(cluster.checkConnectStatus(i+1))
tdDnodes[i].starttaosd() tdDnodes[i].starttaosd()
clusterComCheck.checkMnodeStatus(mnodeNums) clusterComCheck.checkMnodeStatus(mnodeNums)
tdLog.info("Take turns stopping all dnodes ") tdLog.info("Take turns stopping all dnodes ")
# seperate vnode and mnode in different dnodes. # seperate vnode and mnode in different dnodes.
# create database and stable # create database and stable
stopcount =0 stopcount =0
while stopcount < restartNumber: while stopcount < restartNumber:
tdLog.info("first restart loop") tdLog.info("first restart loop")
for i in range(dnodenumbers): for i in range(dnodenumbers):
@ -120,13 +120,13 @@ class TDTestCase:
clusterComCheck.checkDnodes(dnodenumbers) clusterComCheck.checkDnodes(dnodenumbers)
clusterComCheck.checkMnodeStatus(mnodeNums) clusterComCheck.checkMnodeStatus(mnodeNums)
def run(self): def run(self):
# print(self.master_dnode.cfgDict) # print(self.master_dnode.cfgDict)
self.fiveDnodeThreeMnode(5,3,1) self.fiveDnodeThreeMnode(5,3,1)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())