From 4d99188ee84fe8787bbaedd49d35ad44861a190e Mon Sep 17 00:00:00 2001 From: tomchon Date: Sun, 10 Jul 2022 16:12:09 +0800 Subject: [PATCH] test:modify testcase of qnode --- tests/pytest/util/cluster.py | 5 +++-- tests/system-test/2-query/queryQnode.py | 29 ++++++++++--------------- tests/system-test/fulltest.sh | 6 ++--- tests/system-test/test.py | 24 +++++++++++++++----- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index efa83323a4..e892e1cc02 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -58,9 +58,10 @@ class ConfigureyCluster: self.dnodes.append(dnode) return self.dnodes - def create_dnode(self,conn): + def create_dnode(self,conn,dnodeNum): tdSql.init(conn.cursor()) - for dnode in self.dnodes[1:]: + dnodeNum=int(dnodeNum) + for dnode in self.dnodes[1:dnodeNum]: # print(dnode.cfgDict) dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"] tdSql.execute(" create dnode '%s';"%dnode_id) diff --git a/tests/system-test/2-query/queryQnode.py b/tests/system-test/2-query/queryQnode.py index d9976d8f3e..8b893a93d7 100644 --- a/tests/system-test/2-query/queryQnode.py +++ b/tests/system-test/2-query/queryQnode.py @@ -278,22 +278,7 @@ class TDTestCase: tdSql.checkData(0,0,rowsPerSTable) return - # test case1 base - 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------- ") - + # test case : Switch back and forth among the three queryPolicy(1\2\3) def test_case1(self): self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) tdSql.execute("use db1;") @@ -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;") assert unionallQnode==tdSql.queryResult + # test case : queryPolicy = 2 def test_case2(self): self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 10, 2, 1*10) tdSql.query("show qnodes") @@ -438,8 +424,9 @@ class TDTestCase: tdSql.query("select max(c1) from stb10_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"') tdLog.debug("create qnode on dnode 1") tdSql.execute("create qnode on dnode 1") @@ -472,10 +459,16 @@ class TDTestCase: # run case def run(self): # test qnode + tdLog.debug(" test_case1 ............ [start]") self.test_case1() + tdLog.debug(" test_case1 ............ [OK]") + tdLog.debug(" test_case2 ............ [start]") self.test_case2() - + tdLog.debug(" test_case2 ............ [OK]") + tdLog.debug(" test_case3 ............ [start]") self.test_case3() + tdLog.debug(" test_case3 ............ [OK]") + # tdLog.debug(" LIMIT test_case3 ............ [OK]") def stop(self): diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 9f165d6404..f6f902e890 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -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/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/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/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/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 9596efdfc8..0a891759d0 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -64,8 +64,9 @@ if __name__ == "__main__": updateCfgDict = {} execCmd = "" queryPolicy = 1 - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:', [ - 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy']) + createDnodeNums = 1 + 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: if key in ['-h', '--help']: tdLog.printNoPrefix( @@ -81,9 +82,11 @@ if __name__ == "__main__": tdLog.printNoPrefix('-d update cfg dict, base64 json str') tdLog.printNoPrefix('-k not kill valgrind processer') 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('-Q set queryPolicy in one dnode') + tdLog.printNoPrefix('-C create Dnode Numbers in one cluster') + sys.exit(0) @@ -143,6 +146,9 @@ if __name__ == "__main__": if key in ['-Q', '--queryPolicy']: queryPolicy = value + if key in ['-C', '--createDnodeNums']: + createDnodeNums = value + if not execCmd == "": tdDnodes.init(deployPath) print(execCmd) @@ -239,7 +245,11 @@ if __name__ == "__main__": host, config=tdDnodes.getSimCfgPath()) print(tdDnodes.getSimCfgPath(),host) - cluster.create_dnode(conn) + if createDnodeNums == 1: + createDnodeNums=dnodeNums + else: + createDnodeNums=createDnodeNums + cluster.create_dnode(conn,createDnodeNums) try: if cluster.check_dnode(conn) : print("check dnode ready") @@ -314,7 +324,11 @@ if __name__ == "__main__": host, config=tdDnodes.getSimCfgPath()) print(tdDnodes.getSimCfgPath(),host) - cluster.create_dnode(conn) + if createDnodeNums == 1: + createDnodeNums=dnodeNums + else: + createDnodeNums=createDnodeNums + cluster.create_dnode(conn,createDnodeNums) try: if cluster.check_dnode(conn) : print("check dnode ready") -- GitLab