From d4890ee20556148e49b59320de3be639134e5fbd Mon Sep 17 00:00:00 2001 From: tomchon Date: Mon, 27 Jun 2022 11:55:28 +0800 Subject: [PATCH 1/3] test:modify testcase of muti-monde --- .../system-test/6-cluster/5dnode3mnodeStop.py | 177 ------------------ 1 file changed, 177 deletions(-) diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop.py b/tests/system-test/6-cluster/5dnode3mnodeStop.py index c1d5a99af2..1964858104 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop.py @@ -45,179 +45,6 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - - def insert_data(self,count): - # fisrt add data : db\stable\childtable\general table - for couti in count: - tdSql.execute("drop database if exists db%d" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def check3mnode(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[1][2]=='leader' : - if tdSql.queryResult[0][2]=='follower': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - elif tdSql.queryResult[2][2]=='leader' : - if tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[0][2]=='follower': - tdLog.debug("three mnodes is ready in 10s") - break - count+=1 - else: - tdLog.exit("three mnodes is not ready in 10s ") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode1off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='offline' : - if tdSql.queryResult[1][2]=='leader': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - elif tdSql.queryResult[1][2]=='follower': - if tdSql.queryResult[2][2]=='leader': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 1;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'offline') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode2off(self): - count=0 - while count < 40: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[1][2]=='offline': - if tdSql.queryResult[2][2]=='follower': - tdLog.debug("stop mnodes on dnode 2 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 2 failed in 10s ") - - tdSql.error("drop mnode on dnode 2;") - - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,3,'ready') - - def check3mnode3off(self): - count=0 - while count < 10: - time.sleep(1) - tdSql.query("show mnodes;") - if tdSql.checkRows(3) : - tdLog.debug("mnode is three nodes") - else: - tdLog.exit("mnode number is correct") - if tdSql.queryResult[0][2]=='leader' : - if tdSql.queryResult[2][2]=='offline': - if tdSql.queryResult[1][2]=='follower': - tdLog.debug("stop mnodes on dnode 3 successfully in 10s") - break - count+=1 - else: - tdLog.exit("stop mnodes on dnode 3 failed in 10s") - - tdSql.error("drop mnode on dnode 3;") - tdSql.query("show mnodes;") - tdSql.checkRows(3) - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'leader') - tdSql.checkData(0,3,'ready') - tdSql.checkData(1,1,'%s:6130'%self.host) - tdSql.checkData(1,2,'follower') - tdSql.checkData(1,3,'ready') - tdSql.checkData(2,1,'%s:6230'%self.host) - tdSql.checkData(2,2,'offline') - tdSql.checkData(2,3,'ready') - - - def check_dnodes_status(self,dnodeNumbers): - count=0 - while count < 5: - tdSql.query("show dnodes") - # tdLog.debug(tdSql.queryResult) - status=0 - for i in range(dnodeNumbers): - if tdSql.queryResult[i][4] == "ready": - status+=1 - tdLog.debug(status) - - if status == dnodeNumbers: - tdLog.debug(" create cluster with %d dnode and check cluster dnode all ready within 5s! " %dnodeNumbers) - break - count+=1 - time.sleep(1) - else: - tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%dnodeNumbers) def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): tdLog.printNoPrefix("======== test case 1: ") @@ -253,11 +80,7 @@ class TDTestCase: # fisr add three mnodes; tdLog.info("fisr add three mnodes and check mnode status") tdSql.execute("create mnode on dnode 2") -<<<<<<< HEAD clusterComCheck.checkMnodeStatus(2) -======= - time.sleep(10) ->>>>>>> e571567ec2ae0c7668ccf1b8aaaf949fc84bb44c tdSql.execute("create mnode on dnode 3") clusterComCheck.checkMnodeStatus(3) From 2b5b2fee6ee44774d58476e3b21118a52727299b Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 28 Jun 2022 18:11:50 +0800 Subject: [PATCH 2/3] test:modify testcase of muti-mnodes; --- tests/pytest/util/cluster.py | 10 +- tests/pytest/util/common.py | 5 + .../1-insert/insertWithMoreVgroup.py | 6 +- tests/system-test/2-query/queryQnode.py | 342 ++++++++++++++++++ .../5dnode3mnodeSep1VnodeStopDnodeCreateDb.py | 200 ++++++++++ ...dnode3mnodeSep1VnodeStopDnodeCreateStb.py} | 95 +++-- .../5dnode3mnodeSep1VnodeStopMnodeCreateDb.py | 116 +++--- ...5dnode3mnodeSep1VnodeStopMnodeCreateStb.py | 204 +++++++++++ .../5dnode3mnodeSep1VnodeStopVnodeCreateDb.py | 95 +++-- ...5dnode3mnodeSep1VnodeStopVnodeCreateStb.py | 204 +++++++++++ .../6-cluster/5dnode3mnodeStopConnect.py | 132 +++++++ .../6-cluster/clusterCommonCheck.py | 17 +- .../6-cluster/clusterCommonCreate.py | 15 + tests/system-test/fulltest.sh | 15 +- 14 files changed, 1300 insertions(+), 156 deletions(-) create mode 100644 tests/system-test/2-query/queryQnode.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py rename tests/system-test/6-cluster/{5dnode3mnodeSep1VnodeStopCreateDb.py => 5dnode3mnodeSep1VnodeStopDnodeCreateStb.py} (68%) create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py create mode 100644 tests/system-test/6-cluster/5dnode3mnodeStopConnect.py diff --git a/tests/pytest/util/cluster.py b/tests/pytest/util/cluster.py index 21cad4c5bb..efa83323a4 100644 --- a/tests/pytest/util/cluster.py +++ b/tests/pytest/util/cluster.py @@ -26,7 +26,7 @@ class ClusterDnodes(TDDnodes): class ConfigureyCluster: """This will create defined number of dnodes and create a cluster. at the same time, it will return TDDnodes list: dnodes, """ - hostname= socket.gethostname() + hostname = socket.gethostname() def __init__(self): self.dnodes = [] @@ -86,7 +86,13 @@ class ConfigureyCluster: time.sleep(1) else: tdLog.exit("create cluster with %d dnode but check dnode not ready within 5s ! "%self.dnodeNums) - + def checkConnectStatus(self,dnodeNo,hostname=hostname): + dnodeNo = int(dnodeNo) + tdLog.info("check dnode-%d connection"%(dnodeNo+1)) + hostname = socket.gethostname() + port = 6030 + dnodeNo*100 + connectToDnode = tdCom.newcon(host=hostname,port=port) + return connectToDnode cluster = ConfigureyCluster() \ No newline at end of file diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index b43f87be29..ca0c66a9d4 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -379,6 +379,11 @@ class TDCom: tdLog.info("cfgPath: %s" % cfgPath) return cfgPath + def newcon(self,host='localhost',port=6030,user='root',password='taosdata'): + con=taos.connect(host=host, user=user, password=password, port=port) + print(con) + return con + def newcur(self,host='localhost',port=6030,user='root',password='taosdata'): cfgPath = self.getClientCfgPath() con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port) diff --git a/tests/system-test/1-insert/insertWithMoreVgroup.py b/tests/system-test/1-insert/insertWithMoreVgroup.py index 29c293c608..1ebbc1fc57 100644 --- a/tests/system-test/1-insert/insertWithMoreVgroup.py +++ b/tests/system-test/1-insert/insertWithMoreVgroup.py @@ -81,7 +81,7 @@ class TDTestCase: user = "root" password = "taosdata" port =6030 - con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port,config="/home/chr/TDengine/sim/psim/cfg/") cur=con.cursor() print(cur) return cur @@ -401,10 +401,6 @@ class TDTestCase: tdLog.debug(" LIMIT test_case3 ............ [OK]") - # test qnode - self.test_case4() - tdLog.debug(" LIMIT test_case3 ............ [OK]") - return # diff --git a/tests/system-test/2-query/queryQnode.py b/tests/system-test/2-query/queryQnode.py new file mode 100644 index 0000000000..15b643f5d7 --- /dev/null +++ b/tests/system-test/2-query/queryQnode.py @@ -0,0 +1,342 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- + +import sys +import os +import threading as thd +import multiprocessing as mp +from numpy.lib.function_base import insert +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np +import datetime as dt +import time +# constant define +WAITS = 5 # wait seconds + +class TDTestCase: + # + # --------------- main frame ------------------- + # + clientCfgDict = {'queryproxy': '1','debugFlag': 135} + clientCfgDict["queryproxy"] = '2' + clientCfgDict["debugFlag"] = 143 + + updatecfgDict = {'clientCfg': {}} + updatecfgDict = {'debugFlag': 143} + updatecfgDict["clientCfg"] = clientCfgDict + def caseDescription(self): + ''' + limit and offset keyword function test cases; + case1: limit offset base function test + case2: offset return valid + ''' + return + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files or "taosd.exe" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root)-len("/build/bin")] + break + return buildPath + + # init + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + # tdSql.prepare() + # self.create_tables(); + self.ts = 1500000000000 + + # stop + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + + # --------------- case ------------------- + + def newcur(self,host,cfg): + user = "root" + password = "taosdata" + port =6030 + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) + cur=con.cursor() + print(cur) + return cur + + # create tables + def create_tables(self,host,dbname,stbname,count): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tsql.execute("use %s" %dbname) + + pre_create = "create table" + sql = pre_create + count=int(count) + + tdLog.debug("doing create one stable %s and %d child table in %s ..." %(stbname, count ,dbname)) + # print(time.time()) + exeStartTime=time.time() + # print(type(tcountStop),type(tcountStart)) + for i in range(0,count): + sql += " %s_%d using %s tags(%d)"%(stbname,i,stbname,i+1) + if i >0 and i%20000 == 0: + # print(sql) + tsql.execute(sql) + sql = pre_create + # print(time.time()) + # end sql + if sql != pre_create: + # print(sql) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedCreate=count/spendTime + # tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def mutiThread_create_tables(self,host,dbname,stbname,vgroups,threadNumbers,childcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("create database %s"%dbname) + tsql.execute("drop database if exists %s"%dbname) + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + tsql.execute("use %s" %dbname) + count=int(childcount) + threads = [] + for i in range(threadNumbers): + tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.create_tables, args=(host, dbname, stbname+"%d"%i, count,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + speedCreate=threadNumbers*count/spendTime + tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,threadNumbers,threadNumbers*count,speedCreate)) + + return + + # def create_tables(self,host,dbname,stbname,vgroups,tcountStart,tcountStop): + + + # insert data + def insert_data(self, host, dbname, stbname, chilCount, ts_start, rowCount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + tsql.execute("use %s" %dbname) + pre_insert = "insert into " + sql = pre_insert + chilCount=int(chilCount) + allRows=chilCount*rowCount + tdLog.debug("doing insert data into stable-index:%s rows:%d ..."%(stbname, allRows)) + exeStartTime=time.time() + for i in range(0,chilCount): + sql += " %s_%d values "%(stbname,i) + for j in range(rowCount): + sql += "(%d, %d, 'taos_%d') "%(ts_start + j*1000, j, j) + if j >0 and j%4000 == 0: + # print(sql) + tsql.execute(sql) + sql = "insert into %s_%d values " %(stbname,i) + # end sql + if sql != pre_insert: + # print(sql) + print(len(sql)) + tsql.execute(sql) + exeEndTime=time.time() + spendTime=exeEndTime-exeStartTime + speedInsert=allRows/spendTime + tdLog.debug("spent %.2fs to INSERT %d rows into %s , insert rate is %.2f rows/s... [OK]"% (spendTime,allRows,stbname,speedInsert)) + # tdLog.debug("INSERT TABLE DATA ............ [OK]") + return + + def mutiThread_insert_data(self, host, dbname, stbname, threadNumbers, chilCount, ts_start, childrowcount): + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + + tsql=self.newcur(host,config) + tdLog.debug("ready to inser data") + + tsql.execute("use %s" %dbname) + chilCount=int(chilCount) + threads = [] + for i in range(threadNumbers): + # tsql.execute("create stable %s%d(ts timestamp, c1 int, c2 binary(10)) tags(t1 int)"%(stbname,i)) + threads.append(thd.Thread(target=self.insert_data, args=(host, dbname, stbname+"%d"%i, chilCount, ts_start, childrowcount,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + spendTime=end_time-start_time + tableCounts=threadNumbers*chilCount + stableRows=chilCount*childrowcount + allRows=stableRows*threadNumbers + speedInsert=allRows/spendTime + + for i in range(threadNumbers): + tdSql.execute("use %s" %dbname) + tdSql.query("select count(*) from %s%d"%(stbname,i)) + tdSql.checkData(0,0,stableRows) + tdLog.debug("spent %.2fs to insert %d rows into %d stable and %d table, speed is %.2f table/s... [OK]"% (spendTime,allRows,threadNumbers,tableCounts,speedInsert)) + tdLog.debug("INSERT TABLE DATA ............ [OK]") + + return + + + def taosBench(self,jsonFile): + buildPath = self.getBuildPath() + if (buildPath == ""): + tdLog.exit("taosd not found!") + else: + tdLog.info("taosd found in %s" % buildPath) + taosBenchbin = buildPath+ "/build/bin/taosBenchmark" + os.system("%s -f %s -y " %(taosBenchbin,jsonFile)) + + return + def taosBenchCreate(self,host,dropdb,dbname,stbname,vgroups,processNumbers,count): + + # count=50000 + buildPath = self.getBuildPath() + config = buildPath+ "../sim/dnode1/cfg/" + tsql=self.newcur(host,config) + + # insert: create one or mutiple tables per sql and insert multiple rows per sql + tsql.execute("drop database if exists %s"%dbname) + + tsql.execute("create database %s vgroups %d"%(dbname,vgroups)) + print("db has been created") + # tsql.getResult("show databases") + # print(tdSql.queryResult) + tsql.execute("use %s" %dbname) + + threads = [] + for i in range(processNumbers): + jsonfile="1-insert/Vgroups%d%d.json"%(vgroups,i) + os.system("cp -f 1-insert/manyVgroups.json %s"%(jsonfile)) + os.system("sed -i 's/\"name\": \"db\",/\"name\": \"%s\",/g' %s"%(dbname,jsonfile)) + os.system("sed -i 's/\"drop\": \"no\",/\"drop\": \"%s\",/g' %s"%(dropdb,jsonfile)) + os.system("sed -i 's/\"host\": \"127.0.0.1\",/\"host\": \"%s\",/g' %s"%(host,jsonfile)) + os.system("sed -i 's/\"childtable_count\": 10000,/\"childtable_count\": %d,/g' %s "%(count,jsonfile)) + os.system("sed -i 's/\"name\": \"stb1\",/\"name\": \"%s%d\",/g' %s "%(stbname,i,jsonfile)) + os.system("sed -i 's/\"childtable_prefix\": \"stb1_\",/\"childtable_prefix\": \"%s%d_\",/g' %s "%(stbname,i,jsonfile)) + threads.append(mp.Process(target=self.taosBench, args=("%s"%jsonfile,))) + start_time = time.time() + for tr in threads: + tr.start() + for tr in threads: + tr.join() + end_time = time.time() + + spendTime=end_time-start_time + speedCreate=count/spendTime + tdLog.debug("spent %.2fs to create 1 stable and %d table, create speed is %.2f table/s... [OK]"% (spendTime,count,speedCreate)) + return + + def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): + tdSql.execute("use %s"%dbname) + tdSql.query("show stables") + tdSql.checkRows(stableCount) + tdSql.query("show tables") + tdSql.checkRows(CtableCount) + for i in range(stableCount): + tdSql.query("select count(*) from %s%d"%(stbname,i)) + 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------- ") + + def test_case4(self): + self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 1, 2, 1*10) + tdSql.execute("use db1;") + tdSql.query("show dnodes;") + dnodeId=tdSql.getData(0,0) + print(dnodeId) + tdSql.execute("create qnode on dnode %s"%dnodeId) + tdSql.query("select max(c1) from stb10;") + maxQnode=tdSql.getData(0,0) + tdSql.query("select min(c1) from stb11;") + minQnode=tdSql.getData(0,0) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionQnode=tdSql.queryResult + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallQnode=tdSql.queryResult + + # tdSql.query("show qnodes;") + # qnodeId=tdSql.getData(0,0) + tdSql.execute("drop qnode on dnode %s"%dnodeId) + tdSql.execute("reset query cache") + tdSql.query("select max(c1) from stb10;") + tdSql.checkData(0, 0, "%s"%maxQnode) + tdSql.query("select min(c1) from stb11;") + tdSql.checkData(0, 0, "%s"%minQnode) + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;") + unionVnode=tdSql.queryResult + assert unionQnode == unionVnode + tdSql.query("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;") + unionallVnode=tdSql.queryResult + assert unionallQnode == unionallVnode + + + # tdSql.execute("create qnode on dnode %s"%dnodeId) + + # run case + def run(self): + + # test qnode + self.test_case4() + tdLog.debug(" LIMIT test_case3 ............ [OK]") + + + return +# +# add case with filename +# +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py new file mode 100644 index 0000000000..96fad487d1 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py @@ -0,0 +1,200 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """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""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dbNumbers': 20, + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + # while stopcount < restartNumbers: + # tdLog.info(" restart loop: %d"%stopcount ) + # if stopRole == "mnode": + # for i in range(mnodeNums): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + # elif stopRole == "vnode": + # for i in range(vnodeNumbers): + # tdDnodes[i+mnodeNums].stoptaosd() + # # sleep(10) + # tdDnodes[i+mnodeNums].starttaosd() + # # sleep(10) + # elif stopRole == "dnode": + # for i in range(dnodeNumbers): + # tdDnodes[i].stoptaosd() + # # sleep(10) + # tdDnodes[i].starttaosd() + # # sleep(10) + + # # dnodeNumbers don't include database of schema + # if clusterComCheck.checkDnodes(dnodeNumbers): + # tdLog.info("check dnodes status is ready") + # else: + # tdLog.info("check dnodes status is not ready") + # self.stopThread(threads) + # tdLog.exit("one or more of dnodes failed to start ") + # # self.check3mnode() + # stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py similarity index 68% rename from tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py rename to tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py index 59fe1c0b16..4ab9aa64e1 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py @@ -90,35 +90,34 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") - paraDict = {'dbName': 'db', + paraDict = {'dbName': 'db0_0', 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(dnodenumbers * restartNumber) - + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +132,67 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping all dnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable - tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(dnodenumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("first restart loop") + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") else: print("456") - threads.join() + self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(dnodenumbers,'db%d'%i) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='dnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py index cf608f6480..17c344e341 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py @@ -65,59 +65,35 @@ class TDTestCase: self._async_raise(thread.ident, SystemExit) - def insertData(self,countstart,countstop): - # fisrt add data : db\stable\childtable\general table - - for couti in range(countstart,countstop): - tdLog.debug("drop database if exists db%d" %couti) - tdSql.execute("drop database if exists db%d" %couti) - print("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) - tdSql.execute("use db%d" %couti) - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - - - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - dbNumbers = int(mnodeNums * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -132,46 +108,62 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Mnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - tdLog.info("first restart loop") - for i in range(mnodeNums): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[i].stoptaosd() - # sleep(10) - tdDnodes[i].starttaosd() - # sleep(10) + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) - if clusterComCheck.checkDnodes(dnodenumbers): - # threads.join() - tdLog.info("123") + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(mnodeNums,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py new file mode 100644 index 0000000000..29fb3008c3 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """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""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='mnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py index 2d2322fada..e7353b0f13 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py @@ -90,35 +90,35 @@ class TDTestCase: tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') - def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db', + 'dbNumbers': 20, 'dropFlag': 1, 'event': '', 'vgroups': 4, 'replica': 1, 'stbName': 'stb', + 'stbNumbers': 100, 'colPrefix': 'c', 'tagPrefix': 't', 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], 'ctbPrefix': 'ctb', 'ctbNum': 1, - 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 - 'pollDelay': 10, - 'showMsg': 1, - 'showRow': 1} - dnodenumbers=int(dnodenumbers) + } + + dnodeNumbers=int(dnodeNumbers) mnodeNums=int(mnodeNums) - vnodeNumbers = int(dnodenumbers-mnodeNums) - dbNumbers = int(vnodeNumbers * restartNumber) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allDbNumbers=(paraDict['dbNumbers']*restartNumbers) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + tdLog.info("first check dnode and mnode") tdSql.query("show dnodes;") tdSql.checkData(0,1,'%s:6030'%self.host) tdSql.checkData(4,1,'%s:6430'%self.host) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) clusterComCheck.checkMnodeStatus(1) # fisr add three mnodes; @@ -133,45 +133,64 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) - clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkDnodes(dnodeNumbers) - tdLog.info("Take turns stopping Vnodes ") - # seperate vnode and mnode in different dnodes. # create database and stable - tdDnodes=cluster.dnodes - stopcount =0 - while stopcount < restartNumber: - for i in range(vnodeNumbers): - # threads=[] - # threads = MyThreadFunc(self.insert_data(i*2,i*2+2)) - paraDict["dbName"]= 'db%d%d'%(stopcount,i) - threads=threading.Thread(target=clusterComCreate.create_database, args=(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])) - threads.start() - tdDnodes[mnodeNums+i].stoptaosd() - # sleep(10) - tdDnodes[mnodeNums+i].starttaosd() - # sleep(10) - if clusterComCheck.checkDnodes(vnodeNumbers): - # threads.join() - tdLog.info("first restart loop") + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + dbNameIndex = '%s%d'%(paraDict["dbName"],i) + threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(tdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("check dnodes status is ready") else: - print("456") - threads.join() + tdLog.info("check dnodes status is not ready") self.stopThread(threads) tdLog.exit("one or more of dnodes failed to start ") # self.check3mnode() stopcount+=1 - threads.join() - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkDbRows(dbNumbers) - for i in range(restartNumber): - clusterComCheck.checkDb(vnodeNumbers,'db%d'%i) + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(allDbNumbers) + for i in range(restartNumbers): + clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i)) def run(self): # print(self.master_dnode.cfgDict) - self.fiveDnodeThreeMnode(5,3,1) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') def stop(self): tdSql.close() diff --git a/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py new file mode 100644 index 0000000000..2f1c1368d1 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py @@ -0,0 +1,204 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +sys.path.append("./6-cluster") +from clusterCommonCreate import * +from clusterCommonCheck import clusterComCheck + +import time +import socket +import subprocess +from multiprocessing import Process +import threading +import time +import inspect +import ctypes + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + self.TDDnodes = None + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def _async_raise(self, tid, exctype): + """raises the exception, performs cleanup if needed""" + if not inspect.isclass(exctype): + exctype = type(exctype) + res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) + if res == 0: + raise ValueError("invalid thread id") + elif res != 1: + # """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""" + ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) + raise SystemError("PyThreadState_SetAsyncExc failed") + + def stopThread(self,thread): + self._async_raise(thread.ident, SystemExit) + + + def insertData(self,countstart,countstop): + # fisrt add data : db\stable\childtable\general table + + for couti in range(countstart,countstop): + tdLog.debug("drop database if exists db%d" %couti) + tdSql.execute("drop database if exists db%d" %couti) + print("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("create database if not exists db%d replica 1 duration 300" %couti) + tdSql.execute("use db%d" %couti) + tdSql.execute( + '''create table stb1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + tags (t1 int) + ''' + ) + tdSql.execute( + ''' + create table t1 + (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) + ''' + ) + for i in range(4): + tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + + + def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db0_0', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'stbNumbers': 100, + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + } + + dnodeNumbers=int(dnodeNumbers) + mnodeNums=int(mnodeNums) + vnodeNumbers = int(dnodeNumbers-mnodeNums) + allStbNumbers=(paraDict['stbNumbers']*restartNumbers) + dbNumbers = 1 + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodeNumbers) + + # create database and stable + clusterComCreate.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica']) + tdLog.info("Take turns stopping Mnodes ") + + tdDnodes=cluster.dnodes + stopcount =0 + threads=[] + for i in range(restartNumbers): + stableName= '%s%d'%(paraDict['stbName'],i) + threads.append(threading.Thread(target=clusterComCreate.create_stables, args=(tdSql, paraDict["dbName"],stableName,paraDict['stbNumbers']))) + + for tr in threads: + tr.start() + + tdLog.info("Take turns stopping Mnodes ") + while stopcount < restartNumbers: + tdLog.info(" restart loop: %d"%stopcount ) + if stopRole == "mnode": + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + elif stopRole == "vnode": + for i in range(vnodeNumbers): + tdDnodes[i+mnodeNums].stoptaosd() + # sleep(10) + tdDnodes[i+mnodeNums].starttaosd() + # sleep(10) + elif stopRole == "dnode": + for i in range(dnodeNumbers): + tdDnodes[i].stoptaosd() + # sleep(10) + tdDnodes[i].starttaosd() + # sleep(10) + + # dnodeNumbers don't include database of schema + if clusterComCheck.checkDnodes(dnodeNumbers): + tdLog.info("123") + else: + print("456") + + self.stopThread(threads) + tdLog.exit("one or more of dnodes failed to start ") + # self.check3mnode() + stopcount+=1 + + for tr in threads: + tr.join() + clusterComCheck.checkDnodes(dnodeNumbers) + clusterComCheck.checkDbRows(dbNumbers) + clusterComCheck.checkDb(dbNumbers,1,'db0') + + tdSql.execute("use %s" %(paraDict["dbName"])) + tdSql.query("show stables") + tdSql.checkRows(allStbNumbers) + + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(dnodeNumbers=5,mnodeNums=3,restartNumbers=2,stopRole='vnode') + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py new file mode 100644 index 0000000000..247bd29ed9 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeStopConnect.py @@ -0,0 +1,132 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.common import * +from util.cluster import * +from test import tdDnodes +sys.path.append("./6-cluster") + +from clusterCommonCreate import * +from clusterCommonCheck import * +import time +import socket +import subprocess +from multiprocessing import Process + + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + dnodenumbers=int(dnodenumbers) + mnodeNums=int(mnodeNums) + dbNumbers = int(dnodenumbers * restartNumber) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodenumbers) + + # check status of connection + + + + # restart all taosd + tdDnodes=cluster.dnodes + for i in range(mnodeNums): + tdDnodes[i].stoptaosd() + for j in range(dnodenumbers): + if j != i: + cluster.checkConnectStatus(j) + clusterComCheck.check3mnodeoff(i+1,3) + clusterComCheck.init(cluster.checkConnectStatus(i+1)) + tdDnodes[i].starttaosd() + clusterComCheck.checkMnodeStatus(mnodeNums) + + tdLog.info("Take turns stopping all dnodes ") + # seperate vnode and mnode in different dnodes. + # create database and stable + stopcount =0 + while stopcount <= 2: + tdLog.info("first restart loop") + for i in range(dnodenumbers): + tdDnodes[i].stoptaosd() + tdDnodes[i].starttaosd() + stopcount+=1 + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(3) + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(5,3,1) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) \ No newline at end of file diff --git a/tests/system-test/6-cluster/clusterCommonCheck.py b/tests/system-test/6-cluster/clusterCommonCheck.py index d030008963..2d378e623d 100644 --- a/tests/system-test/6-cluster/clusterCommonCheck.py +++ b/tests/system-test/6-cluster/clusterCommonCheck.py @@ -33,7 +33,7 @@ from util.common import * # INSERT_DATA = 3 class ClusterComCheck: - def init(self, conn, logSql): + def init(self, conn, logSql=False): tdSql.init(conn.cursor()) # tdSql.init(conn.cursor(), logSql) # output sql.txt file @@ -71,25 +71,28 @@ class ClusterComCheck: tdLog.debug(tdSql.queryResult) tdLog.exit("we find %d databases but expect %d in clusters! " %(tdSql.queryRows,dbNumbers)) - def checkDb(self,dbNumbers,dbindex): + def checkDb(self,dbNumbers,restartNumber,dbNameIndex): count=0 + alldbNumbers=(dbNumbers*restartNumber)+2 while count < 5: query_status=0 - for i in range(dbNumbers): - for j in range(dbNumbers): + for j in range(dbNumbers): + for i in range(alldbNumbers): tdSql.query("show databases;") - if "%s%d"%(dbindex,j) == tdSql.queryResult[i+2][0] : - if tdSql.queryResult[i+2][19] == "ready": + if "%s_%d"%(dbNameIndex,j) == tdSql.queryResult[i][0] : + if tdSql.queryResult[i][19] == "ready": query_status+=1 + tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j)) else: continue - # print(query_status) + print(query_status) count+=1 if query_status == dbNumbers: tdLog.success("we find cluster with %d dnode and check all databases are ready within 5s! " %dbNumbers) return True else: tdLog.debug(tdSql.queryResult) + tdLog.debug("query status is %d"%query_status) tdLog.exit("database is not ready within 5s") def checkData(self,dbname,stbname,stableCount,CtableCount,rowsPerSTable,): diff --git a/tests/system-test/6-cluster/clusterCommonCreate.py b/tests/system-test/6-cluster/clusterCommonCreate.py index b3107d8537..78aac309a0 100644 --- a/tests/system-test/6-cluster/clusterCommonCreate.py +++ b/tests/system-test/6-cluster/clusterCommonCreate.py @@ -123,11 +123,26 @@ class ClusterComCreate: tdLog.debug("complete to create database %s"%(dbName)) return + def create_databases(self,tsql,dbNameIndex,dbNumbers,dropFlag=1,vgroups=4,replica=1): + for i in range(dbNumbers): + print(dbNumbers) + if dropFlag == 1: + tsql.execute("drop database if exists %s_%d"%(dbNameIndex,i)) + tsql.execute("create database if not exists %s_%d vgroups %d replica %d"%(dbNameIndex,i, vgroups, replica)) + tdLog.debug("complete to create database %s_%d"%(dbNameIndex,i)) + return + def create_stable(self,tsql, dbName,stbName): tsql.execute("create table if not exists %s.%s (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbName, stbName)) tdLog.debug("complete to create %s.%s" %(dbName, stbName)) return + def create_stables(self,tsql,dbNameIndex,stbNameIndex,stbNumbers): + for i in range(stbNumbers): + tsql.execute("create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"%(dbNameIndex, stbNameIndex,i)) + tdLog.debug("complete to create %s.%s_%d" %(dbNameIndex, stbNameIndex,i)) + return + def create_ctable(self,tsql=None, dbName='dbx',stbName='stb',ctbPrefix='ctb',ctbNum=1): tsql.execute("use %s" %dbName) pre_create = "create table" diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 571bb166e1..28b227761a 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -113,16 +113,21 @@ python3 ./test.py -f 2-query/twa.py python3 ./test.py -f 2-query/irate.py python3 ./test.py -f 2-query/function_null.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 python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopCreateDb.py -N 5 -M 3 -# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 - -# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +# 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 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 +# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 +# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py +# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 +python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 + python3 ./test.py -f 7-tmq/basic5.py python3 ./test.py -f 7-tmq/subscribeDb.py From 2d5217ecdbda13bacd6f01ab3bb43a49b517c92d Mon Sep 17 00:00:00 2001 From: haoranchen Date: Tue, 28 Jun 2022 19:17:01 +0800 Subject: [PATCH 3/3] Update insertWithMoreVgroup.py --- tests/system-test/1-insert/insertWithMoreVgroup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system-test/1-insert/insertWithMoreVgroup.py b/tests/system-test/1-insert/insertWithMoreVgroup.py index 1ebbc1fc57..e3a20cebf8 100644 --- a/tests/system-test/1-insert/insertWithMoreVgroup.py +++ b/tests/system-test/1-insert/insertWithMoreVgroup.py @@ -81,7 +81,7 @@ class TDTestCase: user = "root" password = "taosdata" port =6030 - con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port,config="/home/chr/TDengine/sim/psim/cfg/") + con=taos.connect(host=host, user=user, password=password, config=cfg ,port=port) cur=con.cursor() print(cur) return cur @@ -407,4 +407,4 @@ class TDTestCase: # add case with filename # tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase())