fix test cases
This commit is contained in:
parent
8998435f70
commit
8c7329f9a6
|
@ -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 *
|
||||||
|
@ -13,7 +13,7 @@ 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
|
||||||
|
@ -37,7 +37,7 @@ class TDTestCase:
|
||||||
self.host=self.master_dnode.cfgDict["fqdn"]
|
self.host=self.master_dnode.cfgDict["fqdn"]
|
||||||
conn1 = taos.connect(self.master_dnode.cfgDict["fqdn"] , config=self.master_dnode.cfgDir)
|
conn1 = taos.connect(self.master_dnode.cfgDict["fqdn"] , config=self.master_dnode.cfgDir)
|
||||||
tdSql.init(conn1.cursor())
|
tdSql.init(conn1.cursor())
|
||||||
|
|
||||||
|
|
||||||
def getBuildPath(self):
|
def getBuildPath(self):
|
||||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
@ -63,7 +63,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")
|
||||||
|
@ -74,7 +74,7 @@ class TDTestCase:
|
||||||
|
|
||||||
def createDbTbale(self,dbcountStart,dbcountStop,stbname,chilCount):
|
def createDbTbale(self,dbcountStart,dbcountStop,stbname,chilCount):
|
||||||
# fisrt add data : db\stable\childtable\general table
|
# fisrt add data : db\stable\childtable\general table
|
||||||
|
|
||||||
for couti in range(dbcountStart,dbcountStop):
|
for couti in range(dbcountStart,dbcountStop):
|
||||||
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)
|
||||||
|
@ -98,7 +98,7 @@ class TDTestCase:
|
||||||
|
|
||||||
def insertTabaleData(self,dbcountStart,dbcountStop,stbname,chilCount,ts_start,rowCount):
|
def insertTabaleData(self,dbcountStart,dbcountStop,stbname,chilCount,ts_start,rowCount):
|
||||||
# insert data : create childtable and data
|
# insert data : create childtable and data
|
||||||
|
|
||||||
for couti in range(dbcountStart,dbcountStop):
|
for couti in range(dbcountStart,dbcountStop):
|
||||||
tdSql.execute("use db%d" %couti)
|
tdSql.execute("use db%d" %couti)
|
||||||
pre_insert = "insert into "
|
pre_insert = "insert into "
|
||||||
|
@ -115,7 +115,7 @@ class TDTestCase:
|
||||||
# print(sql)
|
# print(sql)
|
||||||
tdSql.execute(sql)
|
tdSql.execute(sql)
|
||||||
sql = "insert into %s_%d values " %(stbname,i)
|
sql = "insert into %s_%d values " %(stbname,i)
|
||||||
# end sql
|
# end sql
|
||||||
if sql != pre_insert:
|
if sql != pre_insert:
|
||||||
# print(sql)
|
# print(sql)
|
||||||
print(len(sql))
|
print(len(sql))
|
||||||
|
@ -134,13 +134,13 @@ class TDTestCase:
|
||||||
for i in range(stableCount):
|
for i in range(stableCount):
|
||||||
tdSql.query("select count(*) from %s%d"%(stbname,i))
|
tdSql.query("select count(*) from %s%d"%(stbname,i))
|
||||||
tdSql.checkData(0,0,rowsPerSTable)
|
tdSql.checkData(0,0,rowsPerSTable)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def depoly_cluster(self ,dnodes_nums):
|
|
||||||
|
def depoly_cluster(self ,dnodes_nums):
|
||||||
|
|
||||||
testCluster = False
|
testCluster = False
|
||||||
valgrind = 0
|
valgrind = 0
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
dnodes = []
|
dnodes = []
|
||||||
start_port = 6030
|
start_port = 6030
|
||||||
|
@ -154,7 +154,7 @@ class TDTestCase:
|
||||||
dnode.addExtraCfg("monitorPort", 7043)
|
dnode.addExtraCfg("monitorPort", 7043)
|
||||||
dnode.addExtraCfg("secondEp", f"{hostname}:{start_port_sec}")
|
dnode.addExtraCfg("secondEp", f"{hostname}:{start_port_sec}")
|
||||||
dnodes.append(dnode)
|
dnodes.append(dnode)
|
||||||
|
|
||||||
self.TDDnodes = MyDnodes(dnodes)
|
self.TDDnodes = MyDnodes(dnodes)
|
||||||
self.TDDnodes.init("")
|
self.TDDnodes.init("")
|
||||||
self.TDDnodes.setTestCluster(testCluster)
|
self.TDDnodes.setTestCluster(testCluster)
|
||||||
|
@ -162,11 +162,11 @@ class TDTestCase:
|
||||||
self.TDDnodes.stopAll()
|
self.TDDnodes.stopAll()
|
||||||
for dnode in self.TDDnodes.dnodes:
|
for dnode in self.TDDnodes.dnodes:
|
||||||
self.TDDnodes.deploy(dnode.index,{})
|
self.TDDnodes.deploy(dnode.index,{})
|
||||||
|
|
||||||
for dnode in self.TDDnodes.dnodes:
|
for dnode in self.TDDnodes.dnodes:
|
||||||
self.TDDnodes.starttaosd(dnode.index)
|
self.TDDnodes.starttaosd(dnode.index)
|
||||||
|
|
||||||
# create cluster
|
# create cluster
|
||||||
for dnode in self.TDDnodes.dnodes[1:]:
|
for dnode in self.TDDnodes.dnodes[1:]:
|
||||||
# print(dnode.cfgDict)
|
# print(dnode.cfgDict)
|
||||||
dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"]
|
dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"]
|
||||||
|
@ -175,7 +175,7 @@ class TDTestCase:
|
||||||
cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;"
|
cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;"
|
||||||
print(cmd)
|
print(cmd)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
tdLog.info(" create cluster with %d dnode done! " %dnodes_nums)
|
tdLog.info(" create cluster with %d dnode done! " %dnodes_nums)
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ class TDTestCase:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
statusReadyBumber=0
|
statusReadyBumber=0
|
||||||
tdSql.query("show dnodes;")
|
tdSql.query("show dnodes;")
|
||||||
if tdSql.checkRows(dnodenumber) :
|
if tdSql.checkRows(dnodenumber) :
|
||||||
print("dnode is %d nodes"%dnodenumber)
|
print("dnode is %d nodes"%dnodenumber)
|
||||||
for i in range(dnodenumber):
|
for i in range(dnodenumber):
|
||||||
if tdSql.queryResult[i][4] !='ready' :
|
if tdSql.queryResult[i][4] !='ready' :
|
||||||
status=tdSql.queryResult[i][4]
|
status=tdSql.queryResult[i][4]
|
||||||
|
@ -203,15 +203,15 @@ class TDTestCase:
|
||||||
else:
|
else:
|
||||||
print("%d mnodes is not ready in 10s "%dnodenumber)
|
print("%d mnodes is not ready in 10s "%dnodenumber)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def check3mnode(self):
|
def check3mnode(self):
|
||||||
count=0
|
count=0
|
||||||
while count < 10:
|
while count < 10:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
if tdSql.checkRows(3) :
|
if tdSql.checkRows(3) :
|
||||||
print("mnode is three nodes")
|
print("mnode is three nodes")
|
||||||
if tdSql.queryResult[0][2]=='leader' :
|
if tdSql.queryResult[0][2]=='leader' :
|
||||||
if tdSql.queryResult[1][2]=='follower':
|
if tdSql.queryResult[1][2]=='follower':
|
||||||
if tdSql.queryResult[2][2]=='follower':
|
if tdSql.queryResult[2][2]=='follower':
|
||||||
|
@ -221,19 +221,19 @@ class TDTestCase:
|
||||||
if tdSql.queryResult[1][2]=='leader':
|
if tdSql.queryResult[1][2]=='leader':
|
||||||
if tdSql.queryResult[2][2]=='follower':
|
if tdSql.queryResult[2][2]=='follower':
|
||||||
print("three mnodes is ready in 10s")
|
print("three mnodes is ready in 10s")
|
||||||
break
|
break
|
||||||
elif tdSql.queryResult[0][2]=='follower' :
|
elif tdSql.queryResult[0][2]=='follower' :
|
||||||
if tdSql.queryResult[1][2]=='follower':
|
if tdSql.queryResult[1][2]=='follower':
|
||||||
if tdSql.queryResult[2][2]=='leader':
|
if tdSql.queryResult[2][2]=='leader':
|
||||||
print("three mnodes is ready in 10s")
|
print("three mnodes is ready in 10s")
|
||||||
break
|
break
|
||||||
count+=1
|
count+=1
|
||||||
else:
|
else:
|
||||||
print("three mnodes is not ready in 10s ")
|
print("three mnodes is not ready in 10s ")
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,1,'%s:6030'%self.host)
|
tdSql.checkData(0,1,'%s:6030'%self.host)
|
||||||
tdSql.checkData(0,3,'ready')
|
tdSql.checkData(0,3,'ready')
|
||||||
tdSql.checkData(1,1,'%s:6130'%self.host)
|
tdSql.checkData(1,1,'%s:6130'%self.host)
|
||||||
|
@ -263,8 +263,8 @@ class TDTestCase:
|
||||||
return -1
|
return -1
|
||||||
tdSql.error("drop mnode on dnode 1;")
|
tdSql.error("drop mnode on dnode 1;")
|
||||||
|
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,1,'%s:6030'%self.host)
|
tdSql.checkData(0,1,'%s:6030'%self.host)
|
||||||
tdSql.checkData(0,2,'offline')
|
tdSql.checkData(0,2,'offline')
|
||||||
tdSql.checkData(0,3,'ready')
|
tdSql.checkData(0,3,'ready')
|
||||||
|
@ -291,8 +291,8 @@ class TDTestCase:
|
||||||
return -1
|
return -1
|
||||||
tdSql.error("drop mnode on dnode 2;")
|
tdSql.error("drop mnode on dnode 2;")
|
||||||
|
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,1,'%s:6030'%self.host)
|
tdSql.checkData(0,1,'%s:6030'%self.host)
|
||||||
tdSql.checkData(0,2,'leader')
|
tdSql.checkData(0,2,'leader')
|
||||||
tdSql.checkData(0,3,'ready')
|
tdSql.checkData(0,3,'ready')
|
||||||
|
@ -320,8 +320,8 @@ class TDTestCase:
|
||||||
print("stop mnodes on dnode 3 failed in 10s")
|
print("stop mnodes on dnode 3 failed in 10s")
|
||||||
return -1
|
return -1
|
||||||
tdSql.error("drop mnode on dnode 3;")
|
tdSql.error("drop mnode on dnode 3;")
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0,1,'%s:6030'%self.host)
|
tdSql.checkData(0,1,'%s:6030'%self.host)
|
||||||
tdSql.checkData(0,2,'leader')
|
tdSql.checkData(0,2,'leader')
|
||||||
tdSql.checkData(0,3,'ready')
|
tdSql.checkData(0,3,'ready')
|
||||||
|
@ -348,8 +348,8 @@ class TDTestCase:
|
||||||
tdSql.checkData(4,1,'%s:6430'%self.host)
|
tdSql.checkData(4,1,'%s:6430'%self.host)
|
||||||
tdSql.checkData(0,4,'ready')
|
tdSql.checkData(0,4,'ready')
|
||||||
tdSql.checkData(4,4,'ready')
|
tdSql.checkData(4,4,'ready')
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0,1,'%s:6030'%self.host)
|
tdSql.checkData(0,1,'%s:6030'%self.host)
|
||||||
tdSql.checkData(0,2,'leader')
|
tdSql.checkData(0,2,'leader')
|
||||||
tdSql.checkData(0,3,'ready')
|
tdSql.checkData(0,3,'ready')
|
||||||
|
@ -364,7 +364,7 @@ class TDTestCase:
|
||||||
tdSql.error("create mnode on dnode 2")
|
tdSql.error("create mnode on dnode 2")
|
||||||
tdSql.query("show dnodes;")
|
tdSql.query("show dnodes;")
|
||||||
print(tdSql.queryResult)
|
print(tdSql.queryResult)
|
||||||
tdLog.debug("stop all of mnode ")
|
tdLog.debug("stop all of mnode ")
|
||||||
|
|
||||||
# drop follower of mnode and insert data
|
# drop follower of mnode and insert data
|
||||||
self.createDbTbale(dbcountStart, dbcountStop,stbname,tablesPerStb)
|
self.createDbTbale(dbcountStart, dbcountStop,stbname,tablesPerStb)
|
||||||
|
@ -378,7 +378,7 @@ class TDTestCase:
|
||||||
rowsPerTable))
|
rowsPerTable))
|
||||||
|
|
||||||
threads.start()
|
threads.start()
|
||||||
dropcount =0
|
dropcount =0
|
||||||
while dropcount <= 10:
|
while dropcount <= 10:
|
||||||
for i in range(1,3):
|
for i in range(1,3):
|
||||||
tdLog.debug("drop mnode on dnode %d"%(i+1))
|
tdLog.debug("drop mnode on dnode %d"%(i+1))
|
||||||
|
@ -415,7 +415,7 @@ class TDTestCase:
|
||||||
return taos.connect(host=host, port=int(port), config=config_dir)
|
return taos.connect(host=host, port=int(port), config=config_dir)
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# print(self.master_dnode.cfgDict)
|
# print(self.master_dnode.cfgDict)
|
||||||
self.buildcluster(5)
|
self.buildcluster(5)
|
||||||
self.five_dnode_three_mnode(5)
|
self.five_dnode_three_mnode(5)
|
||||||
|
@ -425,4 +425,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())
|
||||||
|
|
|
@ -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
|
||||||
|
@ -174,7 +174,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()
|
||||||
|
@ -186,7 +186,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):
|
||||||
|
@ -197,7 +197,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
|
||||||
|
|
||||||
|
|
||||||
clusterComCheck.checkDnodes(dnodeNumbers)
|
clusterComCheck.checkDnodes(dnodeNumbers)
|
||||||
clusterComCheck.checkDbRows(dbNumbers)
|
clusterComCheck.checkDbRows(dbNumbers)
|
||||||
|
@ -211,7 +211,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')
|
||||||
|
|
||||||
|
@ -220,4 +220,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())
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -105,14 +105,14 @@ 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;")
|
||||||
print(tdSql.queryResult)
|
print(tdSql.queryResult)
|
||||||
clusterComCheck.checkDnodes(dnodeNumbers)
|
clusterComCheck.checkDnodes(dnodeNumbers)
|
||||||
|
|
||||||
tdLog.info("create database and stable")
|
tdLog.info("create database and stable")
|
||||||
tdDnodes=cluster.dnodes
|
tdDnodes=cluster.dnodes
|
||||||
stopcount =0
|
stopcount =0
|
||||||
threads=[]
|
threads=[]
|
||||||
|
@ -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()
|
||||||
tdLog.info("check dnode number:")
|
tdLog.info("check dnode number:")
|
||||||
|
@ -170,7 +170,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='mnode')
|
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=10,stopRole='mnode')
|
||||||
|
|
||||||
|
@ -179,4 +179,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())
|
||||||
|
|
|
@ -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
|
||||||
|
@ -31,7 +31,7 @@ class TDTestCase:
|
||||||
tdSql.init(conn.cursor())
|
tdSql.init(conn.cursor())
|
||||||
self.host = socket.gethostname()
|
self.host = socket.gethostname()
|
||||||
print(tdSql)
|
print(tdSql)
|
||||||
|
|
||||||
def getBuildPath(self):
|
def getBuildPath(self):
|
||||||
selfPath = os.path.dirname(os.path.realpath(__file__))
|
selfPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
@ -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")
|
||||||
|
@ -67,7 +67,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)
|
||||||
|
@ -106,13 +106,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)
|
||||||
allStbNumbers=(paraDict['stbNumbers']*restartNumbers)
|
allStbNumbers=(paraDict['stbNumbers']*restartNumbers)
|
||||||
dbNumbers = 1
|
dbNumbers = 1
|
||||||
|
|
||||||
print(tdSql)
|
print(tdSql)
|
||||||
tdLog.info("first check dnode and mnode")
|
tdLog.info("first check dnode and mnode")
|
||||||
tdSql.query("show dnodes;")
|
tdSql.query("show dnodes;")
|
||||||
|
@ -128,7 +128,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;")
|
||||||
|
@ -137,12 +137,12 @@ 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
|
||||||
threads=[]
|
threads=[]
|
||||||
|
|
||||||
for i in range(restartNumbers):
|
for i in range(restartNumbers):
|
||||||
stableName= '%s%d'%(paraDict['stbName'],i)
|
stableName= '%s%d'%(paraDict['stbName'],i)
|
||||||
newTdSql=tdCom.newTdSql()
|
newTdSql=tdCom.newTdSql()
|
||||||
|
@ -151,7 +151,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":
|
||||||
|
@ -159,7 +159,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()
|
||||||
|
@ -171,19 +171,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)
|
||||||
|
@ -197,7 +197,7 @@ class TDTestCase:
|
||||||
tdSql.checkRows(allStbNumbers)
|
tdSql.checkRows(allStbNumbers)
|
||||||
|
|
||||||
|
|
||||||
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='vnode')
|
self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode')
|
||||||
|
|
||||||
|
@ -206,4 +206,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())
|
||||||
|
|
|
@ -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 = 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)
|
||||||
|
@ -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;")
|
||||||
|
@ -100,20 +100,20 @@ class TDTestCase:
|
||||||
# tdLog.info("check whether 2 mnode status is offline")
|
# tdLog.info("check whether 2 mnode status is offline")
|
||||||
# clusterComCheck.check3mnode2off()
|
# clusterComCheck.check3mnode2off()
|
||||||
# tdSql.error("create user user1 pass '123';")
|
# tdSql.error("create user user1 pass '123';")
|
||||||
|
|
||||||
tdLog.info("start one mnode" )
|
tdLog.info("start one mnode" )
|
||||||
tdDnodes[0].starttaosd()
|
tdDnodes[0].starttaosd()
|
||||||
clusterComCheck.check3mnodeoff(2)
|
clusterComCheck.check3mnodeoff(2)
|
||||||
|
|
||||||
clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])
|
clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])
|
||||||
clusterComCheck.checkDb(dbNumbers,1,'db0')
|
clusterComCheck.checkDb(dbNumbers,1,'db0')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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")
|
||||||
|
|
|
@ -48,10 +48,10 @@ class ClusterComCheck:
|
||||||
if tdSql.queryResult[i][4] == "ready":
|
if tdSql.queryResult[i][4] == "ready":
|
||||||
status+=1
|
status+=1
|
||||||
tdLog.info(status)
|
tdLog.info(status)
|
||||||
|
|
||||||
if status == dnodeNumbers:
|
if status == dnodeNumbers:
|
||||||
tdLog.success("it find cluster with %d dnodes and check that all cluster dnodes are ready within 30s! " %dnodeNumbers)
|
tdLog.success("it find cluster with %d dnodes and check that all cluster dnodes are ready within 30s! " %dnodeNumbers)
|
||||||
return True
|
return True
|
||||||
count+=1
|
count+=1
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
|
@ -77,15 +77,15 @@ class ClusterComCheck:
|
||||||
def checkDb(self,dbNumbers,restartNumber,dbNameIndex):
|
def checkDb(self,dbNumbers,restartNumber,dbNameIndex):
|
||||||
count=0
|
count=0
|
||||||
alldbNumbers=(dbNumbers*restartNumber)+2
|
alldbNumbers=(dbNumbers*restartNumber)+2
|
||||||
while count < 5:
|
while count < 5:
|
||||||
query_status=0
|
query_status=0
|
||||||
for j in range(dbNumbers):
|
for j in range(dbNumbers):
|
||||||
for i in range(alldbNumbers):
|
for i in range(alldbNumbers):
|
||||||
tdSql.query("show databases;")
|
tdSql.query("show databases;")
|
||||||
if "%s_%d"%(dbNameIndex,j) == tdSql.queryResult[i][0] :
|
if "%s_%d"%(dbNameIndex,j) == tdSql.queryResult[i][0] :
|
||||||
if tdSql.queryResult[i][15] == "ready":
|
if tdSql.queryResult[i][15] == "ready":
|
||||||
query_status+=1
|
query_status+=1
|
||||||
tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j))
|
tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j))
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
# print(query_status)
|
# print(query_status)
|
||||||
|
@ -107,7 +107,7 @@ class ClusterComCheck:
|
||||||
for i in range(stableCount):
|
for i in range(stableCount):
|
||||||
tdSql.query("select count(*) from %s%d"%(stbname,i))
|
tdSql.query("select count(*) from %s%d"%(stbname,i))
|
||||||
tdSql.checkData(0,0,rowsPerSTable)
|
tdSql.checkData(0,0,rowsPerSTable)
|
||||||
return
|
return
|
||||||
|
|
||||||
def checkMnodeStatus(self,mnodeNums):
|
def checkMnodeStatus(self,mnodeNums):
|
||||||
self.mnodeNums=int(mnodeNums)
|
self.mnodeNums=int(mnodeNums)
|
||||||
|
@ -118,15 +118,15 @@ class ClusterComCheck:
|
||||||
while count < 10:
|
while count < 10:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tdSql.query("show mnodes;")
|
tdSql.query("show mnodes;")
|
||||||
if tdSql.checkRows(self.mnodeNums) :
|
if tdSql.checkRows(self.mnodeNums) :
|
||||||
tdLog.success("cluster has %d mnodes" %self.mnodeNums )
|
tdLog.success("cluster has %d mnodes" %self.mnodeNums )
|
||||||
|
|
||||||
if self.mnodeNums == 1:
|
if self.mnodeNums == 1:
|
||||||
if tdSql.queryResult[0][2]== 'leader' and tdSql.queryResult[0][3]== 'ready' :
|
if tdSql.queryResult[0][2]== 'leader' and tdSql.queryResult[0][3]== 'ready' :
|
||||||
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
||||||
return True
|
return True
|
||||||
count+=1
|
count+=1
|
||||||
elif self.mnodeNums == 3 :
|
elif self.mnodeNums == 3 :
|
||||||
if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' :
|
if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' :
|
||||||
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
||||||
if tdSql.queryResult[2][2]=='follower' and tdSql.queryResult[2][3]== 'ready' :
|
if tdSql.queryResult[2][2]=='follower' and tdSql.queryResult[2][3]== 'ready' :
|
||||||
|
@ -141,9 +141,9 @@ class ClusterComCheck:
|
||||||
if tdSql.queryResult[0][2]=='follower' and tdSql.queryResult[0][3]== 'ready' :
|
if tdSql.queryResult[0][2]=='follower' and tdSql.queryResult[0][3]== 'ready' :
|
||||||
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
||||||
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
||||||
return True
|
return True
|
||||||
count+=1
|
count+=1
|
||||||
elif self.mnodeNums == 2 :
|
elif self.mnodeNums == 2 :
|
||||||
if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' :
|
if tdSql.queryResult[0][2]=='leader' and tdSql.queryResult[0][3]== 'ready' :
|
||||||
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
if tdSql.queryResult[1][2]=='follower' and tdSql.queryResult[1][3]== 'ready' :
|
||||||
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
tdLog.success("%d mnodes is ready in 10s"%self.mnodeNums)
|
||||||
|
@ -157,7 +157,7 @@ class ClusterComCheck:
|
||||||
tdLog.debug(tdSql.queryResult)
|
tdLog.debug(tdSql.queryResult)
|
||||||
tdLog.exit("cluster of %d mnodes is not ready in 10s " %self.mnodeNums)
|
tdLog.exit("cluster of %d mnodes is not ready in 10s " %self.mnodeNums)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check3mnodeoff(self,offlineDnodeNo,mnodeNums=3):
|
def check3mnodeoff(self,offlineDnodeNo,mnodeNums=3):
|
||||||
|
@ -224,7 +224,7 @@ class ClusterComCheck:
|
||||||
else:
|
else:
|
||||||
tdLog.debug(tdSql.queryResult)
|
tdLog.debug(tdSql.queryResult)
|
||||||
tdLog.exit("stop mnodes on dnode %d failed in 10s ")
|
tdLog.exit("stop mnodes on dnode %d failed in 10s ")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue