test:add testcase of mnode clusters
This commit is contained in:
parent
e048047e6c
commit
e7f7c736bf
|
@ -68,6 +68,7 @@ class TDTestCase:
|
|||
my_file = Path(f"{packagePath}/{packageName}")
|
||||
if not my_file.exists():
|
||||
print(f"{packageName} is not exists")
|
||||
tdLog.info(f"cd {packagePath} && wget https://www.tdengine.com/assets-download/3.0/{packageName}")
|
||||
os.system(f"cd {packagePath} && wget https://www.tdengine.com/assets-download/3.0/{packageName}")
|
||||
else:
|
||||
print(f"{packageName} has been exists")
|
||||
|
|
|
@ -161,6 +161,19 @@ class TDTestCase:
|
|||
stableName= '%s_%d'%(paraDict['stbName'],i)
|
||||
newTdSql=tdCom.newTdSql()
|
||||
threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"])))
|
||||
|
||||
for i in range(5):
|
||||
clusterComCreate.createUser(newTdSql,f"user{i}",f"pass{i}")
|
||||
userTdSql=tdCom.newTdSql(user=f"user{i}",password=f"pass{i}")
|
||||
clusterComCreate.alterUser(userTdSql,f"user{i}",f"pass{i+1}")
|
||||
clusterComCreate.deleteUser(newTdSql,f"user{i}")
|
||||
for j in range(5):
|
||||
i=100
|
||||
clusterComCreate.createUser(newTdSql,f"user{i}",f"pass{i}")
|
||||
userTdSql=tdCom.newTdSql(user=f"user{i}",password=f"pass{i}")
|
||||
clusterComCreate.alterUser(userTdSql,f"user{i}",f"pass{i+1}")
|
||||
clusterComCreate.deleteUser(newTdSql,f"user{i}")
|
||||
|
||||
for tr in threads:
|
||||
tr.start()
|
||||
for tr in threads:
|
||||
|
|
|
@ -67,29 +67,11 @@ 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 reCreateUser(self, tdsql, count, user, passwd):
|
||||
clusterComCreate.createUser(tdsql,f"{user}{count}",f"{passwd}{count}")
|
||||
userTdSql=tdCom.newTdSql(user=f"{user}{count}",password=f"{passwd}{count}")
|
||||
clusterComCreate.alterUser(userTdSql,f"{user}{count}",f"{passwd}{count+1}")
|
||||
clusterComCreate.deleteUser(tdsql,f"{user}{count}")
|
||||
|
||||
|
||||
def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole):
|
||||
|
@ -161,6 +143,8 @@ class TDTestCase:
|
|||
stableName= '%s_%d'%(paraDict['stbName'],i)
|
||||
newTdSql=tdCom.newTdSql()
|
||||
threads.append(threading.Thread(target=clusterComCreate.insert_data, args=(newTdSql, paraDict["dbName"],stableName,paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"])))
|
||||
threads.append(threading.Thread(target=self.reCreateUser,args=(newTdSql,i,"user","passwd")))
|
||||
|
||||
for tr in threads:
|
||||
tr.start()
|
||||
|
||||
|
|
|
@ -142,7 +142,19 @@ class ClusterComCreate:
|
|||
tsql.execute("create database if not exists %s_%d vgroups %d replica %d"%(dbNameIndex,1, vgroups, replica))
|
||||
tdLog.debug("complete to create database %s_%d"%(dbNameIndex,1))
|
||||
|
||||
def createUser(self,tsql,user,password):
|
||||
tdLog.info(f"create new user f{user}")
|
||||
tsql.execute(f"CREATE USER {user} PASS '{password}';")
|
||||
|
||||
def alterUser(self,tsql,user,password):
|
||||
tdLog.info(f"alter user {user} pass '{password}'")
|
||||
tsql.execute(f"alter USER {user} pass '{password}' ;")
|
||||
|
||||
def deleteUser(self,tsql,user):
|
||||
tdLog.info(f"drop user f{user}")
|
||||
tsql.execute(f"DROP USER {user} ;")
|
||||
|
||||
|
||||
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))
|
||||
|
|
Loading…
Reference in New Issue