提交 4d99188e 编写于 作者: haoranc's avatar haoranc

test:modify testcase of qnode

上级 dd6b5100
...@@ -58,9 +58,10 @@ class ConfigureyCluster: ...@@ -58,9 +58,10 @@ class ConfigureyCluster:
self.dnodes.append(dnode) self.dnodes.append(dnode)
return self.dnodes return self.dnodes
def create_dnode(self,conn): def create_dnode(self,conn,dnodeNum):
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
for dnode in self.dnodes[1:]: dnodeNum=int(dnodeNum)
for dnode in self.dnodes[1:dnodeNum]:
# print(dnode.cfgDict) # print(dnode.cfgDict)
dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"] dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"]
tdSql.execute(" create dnode '%s';"%dnode_id) tdSql.execute(" create dnode '%s';"%dnode_id)
......
...@@ -278,22 +278,7 @@ class TDTestCase: ...@@ -278,22 +278,7 @@ class TDTestCase:
tdSql.checkData(0,0,rowsPerSTable) tdSql.checkData(0,0,rowsPerSTable)
return return
# test case1 base # test case : Switch back and forth among the three queryPolicy(1\2\3)
def test_case1(self):
#stableCount=threadNumbersCtb
parameterDict = {'vgroups': 1, \
'threadNumbersCtb': 5, \
'threadNumbersIda': 5, \
'stableCount': 5, \
'tablesPerStb': 50, \
'rowsPerTable': 10, \
'dbname': 'db', \
'stbname': 'stb', \
'host': 'localhost', \
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
tdLog.debug("-----create database and muti-thread create tables test------- ")
def test_case1(self): def test_case1(self):
self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10)
tdSql.execute("use db1;") tdSql.execute("use db1;")
...@@ -407,6 +392,7 @@ class TDTestCase: ...@@ -407,6 +392,7 @@ class TDTestCase:
tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
assert unionallQnode==tdSql.queryResult assert unionallQnode==tdSql.queryResult
# test case : queryPolicy = 2
def test_case2(self): def test_case2(self):
self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 10, 2, 1*10) self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 10, 2, 1*10)
tdSql.query("show qnodes") tdSql.query("show qnodes")
...@@ -438,8 +424,9 @@ class TDTestCase: ...@@ -438,8 +424,9 @@ class TDTestCase:
tdSql.query("select max(c1) from stb10_0;") tdSql.query("select max(c1) from stb10_0;")
tdSql.query("select min(c1) from stb11_0;") tdSql.query("select min(c1) from stb11_0;")
def test_case3(self): # test case : queryPolicy = 3
def test_case3(self):
tdSql.execute('alter local "queryPolicy" "3"') tdSql.execute('alter local "queryPolicy" "3"')
tdLog.debug("create qnode on dnode 1") tdLog.debug("create qnode on dnode 1")
tdSql.execute("create qnode on dnode 1") tdSql.execute("create qnode on dnode 1")
...@@ -472,10 +459,16 @@ class TDTestCase: ...@@ -472,10 +459,16 @@ class TDTestCase:
# run case # run case
def run(self): def run(self):
# test qnode # test qnode
tdLog.debug(" test_case1 ............ [start]")
self.test_case1() self.test_case1()
tdLog.debug(" test_case1 ............ [OK]")
tdLog.debug(" test_case2 ............ [start]")
self.test_case2() self.test_case2()
tdLog.debug(" test_case2 ............ [OK]")
tdLog.debug(" test_case3 ............ [start]")
self.test_case3() self.test_case3()
tdLog.debug(" test_case3 ............ [OK]")
# tdLog.debug(" LIMIT test_case3 ............ [OK]") # tdLog.debug(" LIMIT test_case3 ............ [OK]")
def stop(self): def stop(self):
......
...@@ -120,12 +120,12 @@ python3 ./test.py -f 2-query/irate.py ...@@ -120,12 +120,12 @@ python3 ./test.py -f 2-query/irate.py
python3 ./test.py -f 2-query/and_or_for_byte.py python3 ./test.py -f 2-query/and_or_for_byte.py
python3 ./test.py -f 2-query/function_null.py python3 ./test.py -f 2-query/function_null.py
python3 ./test.py -f 2-query/queryQnode.py #python3 ./test.py -f 2-query/queryQnode.py
python3 ./test.py -f 6-cluster/5dnode1mnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py
#python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 #BUG python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3
#python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 #python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3
#python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3
# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3
# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3
python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3
......
...@@ -64,8 +64,9 @@ if __name__ == "__main__": ...@@ -64,8 +64,9 @@ if __name__ == "__main__":
updateCfgDict = {} updateCfgDict = {}
execCmd = "" execCmd = ""
queryPolicy = 1 queryPolicy = 1
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:', [ createDnodeNums = 1
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy']) opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums'])
for key, value in opts: for key, value in opts:
if key in ['-h', '--help']: if key in ['-h', '--help']:
tdLog.printNoPrefix( tdLog.printNoPrefix(
...@@ -81,9 +82,11 @@ if __name__ == "__main__": ...@@ -81,9 +82,11 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-d update cfg dict, base64 json str') tdLog.printNoPrefix('-d update cfg dict, base64 json str')
tdLog.printNoPrefix('-k not kill valgrind processer') tdLog.printNoPrefix('-k not kill valgrind processer')
tdLog.printNoPrefix('-e eval str to run') tdLog.printNoPrefix('-e eval str to run')
tdLog.printNoPrefix('-N create dnodes numbers in clusters') tdLog.printNoPrefix('-N start dnodes numbers in clusters')
tdLog.printNoPrefix('-M create mnode numbers in clusters') tdLog.printNoPrefix('-M create mnode numbers in clusters')
tdLog.printNoPrefix('-Q set queryPolicy in one dnode') tdLog.printNoPrefix('-Q set queryPolicy in one dnode')
tdLog.printNoPrefix('-C create Dnode Numbers in one cluster')
sys.exit(0) sys.exit(0)
...@@ -143,6 +146,9 @@ if __name__ == "__main__": ...@@ -143,6 +146,9 @@ if __name__ == "__main__":
if key in ['-Q', '--queryPolicy']: if key in ['-Q', '--queryPolicy']:
queryPolicy = value queryPolicy = value
if key in ['-C', '--createDnodeNums']:
createDnodeNums = value
if not execCmd == "": if not execCmd == "":
tdDnodes.init(deployPath) tdDnodes.init(deployPath)
print(execCmd) print(execCmd)
...@@ -239,7 +245,11 @@ if __name__ == "__main__": ...@@ -239,7 +245,11 @@ if __name__ == "__main__":
host, host,
config=tdDnodes.getSimCfgPath()) config=tdDnodes.getSimCfgPath())
print(tdDnodes.getSimCfgPath(),host) print(tdDnodes.getSimCfgPath(),host)
cluster.create_dnode(conn) if createDnodeNums == 1:
createDnodeNums=dnodeNums
else:
createDnodeNums=createDnodeNums
cluster.create_dnode(conn,createDnodeNums)
try: try:
if cluster.check_dnode(conn) : if cluster.check_dnode(conn) :
print("check dnode ready") print("check dnode ready")
...@@ -314,7 +324,11 @@ if __name__ == "__main__": ...@@ -314,7 +324,11 @@ if __name__ == "__main__":
host, host,
config=tdDnodes.getSimCfgPath()) config=tdDnodes.getSimCfgPath())
print(tdDnodes.getSimCfgPath(),host) print(tdDnodes.getSimCfgPath(),host)
cluster.create_dnode(conn) if createDnodeNums == 1:
createDnodeNums=dnodeNums
else:
createDnodeNums=createDnodeNums
cluster.create_dnode(conn,createDnodeNums)
try: try:
if cluster.check_dnode(conn) : if cluster.check_dnode(conn) :
print("check dnode ready") print("check dnode ready")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册