fix test cases

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

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 *
@ -17,8 +17,8 @@ import subprocess
sys.path.append("./6-cluster") sys.path.append("./6-cluster")
from clusterCommonCreate import * from clusterCommonCreate import *
from clusterCommonCheck import * from clusterCommonCheck import *
class TDTestCase: class TDTestCase:
def init(self,conn ,logSql): def init(self,conn ,logSql):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
@ -48,7 +48,7 @@ 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.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')
@ -63,7 +63,7 @@ class TDTestCase:
while count < 10: while count < 10:
time.sleep(1) time.sleep(1)
tdSql.query("show mnodes;") tdSql.query("show mnodes;")
tdSql.checkRows(2) tdSql.checkRows(2)
if tdSql.queryResult[0][2]=='leader' : if tdSql.queryResult[0][2]=='leader' :
if tdSql.queryResult[1][2]=='follower': if tdSql.queryResult[1][2]=='follower':
print("two mnodes is ready") print("two mnodes is ready")
@ -73,7 +73,7 @@ class TDTestCase:
print("two mnodes is not ready in 10s ") print("two mnodes is not ready in 10s ")
# fisrt check statut ready # fisrt check statut ready
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')
@ -106,7 +106,7 @@ class TDTestCase:
clusterComCheck.checkDnodes(5) clusterComCheck.checkDnodes(5)
# restart all taosd # restart all taosd
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
# stop follower # stop follower
tdLog.info("stop follower") tdLog.info("stop follower")
tdDnodes[1].stoptaosd() tdDnodes[1].stoptaosd()
@ -118,7 +118,7 @@ class TDTestCase:
tdDnodes[1].starttaosd() tdDnodes[1].starttaosd()
if clusterComCheck.checkMnodeStatus(2) : if clusterComCheck.checkMnodeStatus(2) :
print("both mnodes are ready") print("both mnodes are ready")
# stop leader # stop leader
tdLog.info("stop leader") tdLog.info("stop leader")
tdDnodes[0].stoptaosd() tdDnodes[0].stoptaosd()
@ -133,7 +133,7 @@ class TDTestCase:
if clusterComCheck.checkMnodeStatus(2) : if clusterComCheck.checkMnodeStatus(2) :
print("both mnodes are ready") print("both mnodes are ready")
def run(self): def run(self):
self.five_dnode_two_mnode() self.five_dnode_two_mnode()
@ -142,4 +142,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)
@ -112,7 +112,7 @@ class TDTestCase:
} }
username="user1" username="user1"
passwd="123" passwd="123"
dnodeNumbers=int(dnodeNumbers) dnodeNumbers=int(dnodeNumbers)
mnodeNums=int(mnodeNums) mnodeNums=int(mnodeNums)
vnodeNumbers = int(dnodeNumbers-mnodeNums) vnodeNumbers = int(dnodeNumbers-mnodeNums)
@ -120,7 +120,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)
@ -135,7 +135,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;")
@ -162,10 +162,10 @@ class TDTestCase:
for i in range(tdSql.queryRows): for i in range(tdSql.queryRows):
if tdSql.queryResult[i][0] == "%s"%username : if tdSql.queryResult[i][0] == "%s"%username :
tdLog.info("create user:%s successfully"%username) tdLog.info("create user:%s successfully"%username)
# # 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
@ -197,7 +197,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()
@ -209,7 +209,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):
@ -220,7 +220,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)
@ -234,7 +234,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')
@ -243,4 +243,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")
@ -81,13 +81,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
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)
@ -102,7 +102,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;")
@ -111,7 +111,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
@ -130,7 +130,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()
@ -142,19 +142,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)
@ -169,7 +169,7 @@ class TDTestCase:
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')
@ -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 *
@ -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")
@ -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
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)
@ -127,7 +127,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;")
@ -148,7 +148,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 )
@ -157,7 +157,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()
@ -169,19 +169,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)
@ -195,7 +195,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='mnode') self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode')
@ -204,4 +204,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 = 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;")
@ -99,7 +99,7 @@ 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 two follower") tdLog.info("start two follower")
tdDnodes[1].starttaosd() tdDnodes[1].starttaosd()
tdDnodes[2].starttaosd() tdDnodes[2].starttaosd()
@ -107,10 +107,10 @@ class TDTestCase:
clusterComCheck.checkMnodeStatus(mnodeNums) clusterComCheck.checkMnodeStatus(mnodeNums)
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 *
@ -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;")
@ -93,10 +93,10 @@ class TDTestCase:
# restart all taosd # restart all taosd
tdDnodes=cluster.dnodes tdDnodes=cluster.dnodes
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 <= 2: while stopcount <= 2:
tdLog.info(" restart loop: %d"%stopcount ) tdLog.info(" restart loop: %d"%stopcount )
for i in range(dnodenumbers): for i in range(dnodenumbers):
@ -106,10 +106,10 @@ class TDTestCase:
clusterComCheck.checkDnodes(dnodenumbers) clusterComCheck.checkDnodes(dnodenumbers)
clusterComCheck.checkMnodeStatus(3) clusterComCheck.checkMnodeStatus(3)
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")