Merge pull request #14414 from taosdata/test/chr/TD-14699
test:modify testcase of stmt
This commit is contained in:
commit
9560b2ee71
|
@ -355,40 +355,6 @@ class TDTestCase:
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
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
|
# run case
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ class TDTestCase:
|
||||||
return con
|
return con
|
||||||
|
|
||||||
def test_stmt_set_tbname_tag(self,conn):
|
def test_stmt_set_tbname_tag(self,conn):
|
||||||
dbname = "stmt_set_tbname_tag"
|
dbname = "stmt_tag"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conn.execute("drop database if exists %s" % dbname)
|
conn.execute("drop database if exists %s" % dbname)
|
||||||
|
@ -196,31 +196,31 @@ class TDTestCase:
|
||||||
assert rows9[0][0] == 12, 'fourth case is failed'
|
assert rows9[0][0] == 12, 'fourth case is failed'
|
||||||
assert rows9[1][0] == 12, 'fourth case is failed'
|
assert rows9[1][0] == 12, 'fourth case is failed'
|
||||||
|
|
||||||
# #query: conversion Functions
|
#query: conversion Functions
|
||||||
|
|
||||||
# querystmt4=conn.statement("select cast( ? as bigint) from log ")
|
querystmt4=conn.statement("select cast( ? as bigint) from log ")
|
||||||
# queryparam4=new_bind_params(1)
|
queryparam4=new_bind_params(1)
|
||||||
# print(type(queryparam4))
|
print(type(queryparam4))
|
||||||
# queryparam4[0].binary('1232a')
|
queryparam4[0].binary('1232a')
|
||||||
# querystmt4.bind_param(queryparam4)
|
querystmt4.bind_param(queryparam4)
|
||||||
# querystmt4.execute()
|
querystmt4.execute()
|
||||||
# result4=querystmt4.use_result()
|
result4=querystmt4.use_result()
|
||||||
# rows4=result4.fetch_all()
|
rows4=result4.fetch_all()
|
||||||
# print("5",rows4)
|
print("5",rows4)
|
||||||
# assert rows4[0][0] == 1232
|
assert rows4[0][0] == 1232
|
||||||
# assert rows4[1][0] == 1232
|
assert rows4[1][0] == 1232
|
||||||
|
|
||||||
# querystmt4=conn.statement("select cast( ? as binary(10)) from log ")
|
querystmt4=conn.statement("select cast( ? as binary(10)) from log ")
|
||||||
# queryparam4=new_bind_params(1)
|
queryparam4=new_bind_params(1)
|
||||||
# print(type(queryparam4))
|
print(type(queryparam4))
|
||||||
# queryparam4[0].int(123)
|
queryparam4[0].int(123)
|
||||||
# querystmt4.bind_param(queryparam4)
|
querystmt4.bind_param(queryparam4)
|
||||||
# querystmt4.execute()
|
querystmt4.execute()
|
||||||
# result4=querystmt4.use_result()
|
result4=querystmt4.use_result()
|
||||||
# rows4=result4.fetch_all()
|
rows4=result4.fetch_all()
|
||||||
# print("6",rows4)
|
print("6",rows4)
|
||||||
# assert rows4[0][0] == '123'
|
assert rows4[0][0] == '123'
|
||||||
# assert rows4[1][0] == '123'
|
assert rows4[1][0] == '123'
|
||||||
|
|
||||||
# #query: datatime Functions
|
# #query: datatime Functions
|
||||||
|
|
||||||
|
|
|
@ -84,21 +84,21 @@ class TDTestCase:
|
||||||
def test_stmt_insert_multi(self,conn):
|
def test_stmt_insert_multi(self,conn):
|
||||||
# type: (TaosConnection) -> None
|
# type: (TaosConnection) -> None
|
||||||
|
|
||||||
dbname = "pytest_taos_stmt_multi"
|
dbname = "db_stmt"
|
||||||
try:
|
try:
|
||||||
conn.execute("drop database if exists %s" % dbname)
|
conn.execute("drop database if exists %s" % dbname)
|
||||||
conn.execute("create database if not exists %s" % dbname)
|
conn.execute("create database if not exists %s" % dbname)
|
||||||
conn.select_db(dbname)
|
conn.select_db(dbname)
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"create table if not exists log(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\
|
"create table if not exists stb1(ts timestamp, bo bool, nil tinyint, ti tinyint, si smallint, ii int,\
|
||||||
bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \
|
bi bigint, tu tinyint unsigned, su smallint unsigned, iu int unsigned, bu bigint unsigned, \
|
||||||
ff float, dd double, bb binary(100), nn nchar(100), tt timestamp)",
|
ff float, dd double, bb binary(100), nn nchar(100), tt timestamp)",
|
||||||
)
|
)
|
||||||
# conn.load_table_info("log")
|
# conn.load_table_info("log")
|
||||||
|
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
stmt = conn.statement("insert into log values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
stmt = conn.statement("insert into stb1 values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
||||||
|
|
||||||
params = new_multi_binds(16)
|
params = new_multi_binds(16)
|
||||||
params[0].timestamp((1626861392589, 1626861392590, 1626861392591))
|
params[0].timestamp((1626861392589, 1626861392590, 1626861392591))
|
||||||
|
@ -125,7 +125,7 @@ class TDTestCase:
|
||||||
assert stmt.affected_rows == 3
|
assert stmt.affected_rows == 3
|
||||||
|
|
||||||
#query 1
|
#query 1
|
||||||
querystmt=conn.statement("select ?,bu from log")
|
querystmt=conn.statement("select ?,bu from stb1")
|
||||||
queryparam=new_bind_params(1)
|
queryparam=new_bind_params(1)
|
||||||
print(type(queryparam))
|
print(type(queryparam))
|
||||||
queryparam[0].binary("ts")
|
queryparam[0].binary("ts")
|
||||||
|
@ -135,7 +135,7 @@ class TDTestCase:
|
||||||
# rows=result.fetch_all()
|
# rows=result.fetch_all()
|
||||||
# print( querystmt.use_result())
|
# print( querystmt.use_result())
|
||||||
|
|
||||||
# result = conn.query("select * from log")
|
# result = conn.query("select * from stb1")
|
||||||
rows=result.fetch_all()
|
rows=result.fetch_all()
|
||||||
# rows=result.fetch_all()
|
# rows=result.fetch_all()
|
||||||
print(rows)
|
print(rows)
|
||||||
|
@ -144,7 +144,7 @@ class TDTestCase:
|
||||||
assert rows[2][1] == None
|
assert rows[2][1] == None
|
||||||
|
|
||||||
#query 2
|
#query 2
|
||||||
querystmt1=conn.statement("select * from log where bu < ?")
|
querystmt1=conn.statement("select * from stb1 where bu < ?")
|
||||||
queryparam1=new_bind_params(1)
|
queryparam1=new_bind_params(1)
|
||||||
print(type(queryparam1))
|
print(type(queryparam1))
|
||||||
queryparam1[0].int(4)
|
queryparam1[0].int(4)
|
||||||
|
|
|
@ -17,6 +17,8 @@ import threading as thd
|
||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
from numpy.lib.function_base import insert
|
from numpy.lib.function_base import insert
|
||||||
import taos
|
import taos
|
||||||
|
from util.dnodes import TDDnode
|
||||||
|
from util.dnodes import *
|
||||||
from util.log import *
|
from util.log import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
|
@ -30,9 +32,9 @@ class TDTestCase:
|
||||||
#
|
#
|
||||||
# --------------- main frame -------------------
|
# --------------- main frame -------------------
|
||||||
#
|
#
|
||||||
clientCfgDict = {'queryproxy': '1','debugFlag': 135}
|
clientCfgDict = {'queryPolicy': '1','debugFlag': 135}
|
||||||
clientCfgDict["queryproxy"] = '2'
|
clientCfgDict["queryPolicy"] = '1'
|
||||||
clientCfgDict["debugFlag"] = 143
|
clientCfgDict["debugFlag"] = 131
|
||||||
|
|
||||||
updatecfgDict = {'clientCfg': {}}
|
updatecfgDict = {'clientCfg': {}}
|
||||||
updatecfgDict = {'debugFlag': 143}
|
updatecfgDict = {'debugFlag': 143}
|
||||||
|
@ -62,7 +64,7 @@ class TDTestCase:
|
||||||
return buildPath
|
return buildPath
|
||||||
|
|
||||||
# init
|
# init
|
||||||
def init(self, conn, logSql):
|
def init(self, conn, logSql=True):
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
tdSql.init(conn.cursor())
|
tdSql.init(conn.cursor())
|
||||||
# tdSql.prepare()
|
# tdSql.prepare()
|
||||||
|
@ -292,12 +294,13 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.debug("-----create database and muti-thread create tables test------- ")
|
tdLog.debug("-----create database and muti-thread create tables test------- ")
|
||||||
|
|
||||||
def test_case4(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;")
|
||||||
tdSql.query("show dnodes;")
|
tdSql.query("show dnodes;")
|
||||||
dnodeId=tdSql.getData(0,0)
|
dnodeId=tdSql.getData(0,0)
|
||||||
print(dnodeId)
|
print(dnodeId)
|
||||||
|
tdLog.debug("create qnode on dnode %s"%dnodeId)
|
||||||
tdSql.execute("create qnode on dnode %s"%dnodeId)
|
tdSql.execute("create qnode on dnode %s"%dnodeId)
|
||||||
tdSql.query("select max(c1) from stb10;")
|
tdSql.query("select max(c1) from stb10;")
|
||||||
maxQnode=tdSql.getData(0,0)
|
maxQnode=tdSql.getData(0,0)
|
||||||
|
@ -310,6 +313,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# tdSql.query("show qnodes;")
|
# tdSql.query("show qnodes;")
|
||||||
# qnodeId=tdSql.getData(0,0)
|
# qnodeId=tdSql.getData(0,0)
|
||||||
|
tdLog.debug("drop qnode on dnode %s"%dnodeId)
|
||||||
tdSql.execute("drop qnode on dnode %s"%dnodeId)
|
tdSql.execute("drop qnode on dnode %s"%dnodeId)
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select max(c1) from stb10;")
|
tdSql.query("select max(c1) from stb10;")
|
||||||
|
@ -323,15 +327,156 @@ class TDTestCase:
|
||||||
unionallVnode=tdSql.queryResult
|
unionallVnode=tdSql.queryResult
|
||||||
assert unionallQnode == unionallVnode
|
assert unionallQnode == unionallVnode
|
||||||
|
|
||||||
|
queryPolicy=2
|
||||||
|
simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath()
|
||||||
|
cmd='sed -i "s/^queryPolicy.*/queryPolicy 2/g" %s'%simClientCfg
|
||||||
|
os.system(cmd)
|
||||||
|
# tdDnodes.stop(1)
|
||||||
|
# tdDnodes.start(1)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy)
|
||||||
|
tdSql.query("show local variables;")
|
||||||
|
for i in range(tdSql.queryRows):
|
||||||
|
if tdSql.queryResult[i][0] == "queryPolicy" :
|
||||||
|
if int(tdSql.queryResult[i][1]) == int(queryPolicy):
|
||||||
|
tdLog.success('alter queryPolicy to %d successfully'%queryPolicy)
|
||||||
|
else :
|
||||||
|
tdLog.debug(tdSql.queryResult)
|
||||||
|
tdLog.exit("alter queryPolicy to %d failed"%queryPolicy)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
|
||||||
|
tdSql.execute("use db1;")
|
||||||
|
tdSql.query("show dnodes;")
|
||||||
|
dnodeId=tdSql.getData(0,0)
|
||||||
|
tdLog.debug("create qnode on dnode %s"%dnodeId)
|
||||||
|
|
||||||
|
tdSql.execute("create qnode on dnode %s"%dnodeId)
|
||||||
|
tdSql.query("select max(c1) from stb10;")
|
||||||
|
assert maxQnode==tdSql.getData(0,0)
|
||||||
|
tdSql.query("select min(c1) from stb11;")
|
||||||
|
assert 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;")
|
||||||
|
assert 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;")
|
||||||
|
assert unionallQnode==tdSql.queryResult
|
||||||
|
|
||||||
|
# tdSql.query("show qnodes;")
|
||||||
|
# qnodeId=tdSql.getData(0,0)
|
||||||
|
tdLog.debug("drop qnode on dnode %s"%dnodeId)
|
||||||
|
tdSql.execute("drop qnode on dnode %s"%dnodeId)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
tdSql.query("select max(c1) from stb10;")
|
||||||
|
assert maxQnode==tdSql.getData(0,0)
|
||||||
|
tdSql.query("select min(c1) from stb11;")
|
||||||
|
assert minQnode==tdSql.getData(0,0)
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
|
||||||
# tdSql.execute("create qnode on dnode %s"%dnodeId)
|
# tdSql.execute("create qnode on dnode %s"%dnodeId)
|
||||||
|
|
||||||
|
queryPolicy=3
|
||||||
|
simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath()
|
||||||
|
cmd='sed -i "s/^queryPolicy.*/queryPolicy 2/g" %s'%simClientCfg
|
||||||
|
os.system(cmd)
|
||||||
|
# tdDnodes.stop(1)
|
||||||
|
# tdDnodes.start(1)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy)
|
||||||
|
tdSql.query("show local variables;")
|
||||||
|
for i in range(tdSql.queryRows):
|
||||||
|
if tdSql.queryResult[i][0] == "queryPolicy" :
|
||||||
|
if int(tdSql.queryResult[i][1]) == int(queryPolicy):
|
||||||
|
tdLog.success('alter queryPolicy to %d successfully'%queryPolicy)
|
||||||
|
else :
|
||||||
|
tdLog.debug(tdSql.queryResult)
|
||||||
|
tdLog.exit("alter queryPolicy to %d failed"%queryPolicy)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
|
||||||
|
tdSql.execute("use db1;")
|
||||||
|
tdSql.query("show dnodes;")
|
||||||
|
dnodeId=tdSql.getData(0,0)
|
||||||
|
tdLog.debug("create qnode on dnode %s"%dnodeId)
|
||||||
|
|
||||||
|
tdSql.execute("create qnode on dnode %s"%dnodeId)
|
||||||
|
tdSql.query("select max(c1) from stb10;")
|
||||||
|
assert maxQnode==tdSql.getData(0,0)
|
||||||
|
tdSql.query("select min(c1) from stb11;")
|
||||||
|
assert 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;")
|
||||||
|
assert 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;")
|
||||||
|
assert unionallQnode==tdSql.queryResult
|
||||||
|
|
||||||
|
def test_case2(self):
|
||||||
|
self.taosBenchCreate("127.0.0.1","no","db1", "stb1", 10, 2, 1*10)
|
||||||
|
tdSql.query("show qnodes")
|
||||||
|
if tdSql.queryRows == 1 :
|
||||||
|
tdLog.debug("drop qnode on dnode 1")
|
||||||
|
tdSql.execute("drop qnode on dnode 1")
|
||||||
|
queryPolicy=2
|
||||||
|
simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath()
|
||||||
|
cmd='sed -i "s/^queryPolicy.*/queryPolicy 2/g" %s'%simClientCfg
|
||||||
|
os.system(cmd)
|
||||||
|
# tdDnodes.stop(1)
|
||||||
|
# tdDnodes.start(1)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
tdSql.execute('alter local "queryPolicy" "%d"'%queryPolicy)
|
||||||
|
tdSql.query("show local variables;")
|
||||||
|
for i in range(tdSql.queryRows):
|
||||||
|
if tdSql.queryResult[i][0] == "queryPolicy" :
|
||||||
|
if int(tdSql.queryResult[i][1]) == int(queryPolicy):
|
||||||
|
tdLog.success('alter queryPolicy to %d successfully'%queryPolicy)
|
||||||
|
else :
|
||||||
|
tdLog.debug(tdSql.queryResult)
|
||||||
|
tdLog.exit("alter queryPolicy to %d failed"%queryPolicy)
|
||||||
|
tdSql.execute("use db1;")
|
||||||
|
tdSql.error("select max(c1) from stb10;")
|
||||||
|
tdSql.error("select min(c1) from stb11;")
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
|
||||||
|
tdSql.query("select max(c1) from stb10_0;")
|
||||||
|
tdSql.query("select min(c1) from stb11_0;")
|
||||||
|
|
||||||
|
def test_case3(self):
|
||||||
|
|
||||||
|
tdSql.execute('alter local "queryPolicy" "3"')
|
||||||
|
tdLog.debug("create qnode on dnode 1")
|
||||||
|
tdSql.execute("create qnode on dnode 1")
|
||||||
|
tdSql.execute("use db1;")
|
||||||
|
tdSql.query("show dnodes;")
|
||||||
|
dnodeId=tdSql.getData(0,0)
|
||||||
|
print(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)
|
||||||
|
tdLog.debug("drop qnode on dnode %s"%dnodeId)
|
||||||
|
|
||||||
|
tdSql.execute("drop qnode on dnode %s"%dnodeId)
|
||||||
|
tdSql.execute("reset query cache")
|
||||||
|
|
||||||
|
tdSql.error("select max(c1) from stb10;")
|
||||||
|
tdSql.error("select min(c1) from stb11;")
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
tdSql.error("select c0,c1 from stb11_1 where (c0>1000) union all select c0,c1 from stb11_1 where c0>2000;")
|
||||||
|
|
||||||
# run case
|
# run case
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
# test qnode
|
# test qnode
|
||||||
self.test_case4()
|
self.test_case1()
|
||||||
tdLog.debug(" LIMIT test_case3 ............ [OK]")
|
self.test_case2()
|
||||||
|
|
||||||
|
self.test_case3()
|
||||||
|
# tdLog.debug(" LIMIT test_case3 ............ [OK]")
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -65,31 +65,6 @@ class TDTestCase:
|
||||||
self._async_raise(thread.ident, SystemExit)
|
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):
|
def fiveDnodeThreeMnode(self,dnodeNumbers,mnodeNums,restartNumbers,stopRole):
|
||||||
tdLog.printNoPrefix("======== test case 1: ")
|
tdLog.printNoPrefix("======== test case 1: ")
|
||||||
paraDict = {'dbName': 'db',
|
paraDict = {'dbName': 'db',
|
||||||
|
@ -143,7 +118,8 @@ class TDTestCase:
|
||||||
threads=[]
|
threads=[]
|
||||||
for i in range(restartNumbers):
|
for i in range(restartNumbers):
|
||||||
dbNameIndex = '%s%d'%(paraDict["dbName"],i)
|
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'])))
|
newTdSql=tdCom.newTdSql()
|
||||||
|
threads.append(threading.Thread(target=clusterComCreate.create_databases, args=(newTdSql, dbNameIndex,paraDict["dbNumbers"],paraDict["dropFlag"], paraDict["vgroups"],paraDict['replica'])))
|
||||||
|
|
||||||
for tr in threads:
|
for tr in threads:
|
||||||
tr.start()
|
tr.start()
|
||||||
|
|
|
@ -39,6 +39,7 @@ class ClusterComCheck:
|
||||||
|
|
||||||
def checkDnodes(self,dnodeNumbers):
|
def checkDnodes(self,dnodeNumbers):
|
||||||
count=0
|
count=0
|
||||||
|
# print(tdSql)
|
||||||
while count < 5:
|
while count < 5:
|
||||||
tdSql.query("show dnodes")
|
tdSql.query("show dnodes")
|
||||||
# tdLog.debug(tdSql.queryResult)
|
# tdLog.debug(tdSql.queryResult)
|
||||||
|
@ -85,7 +86,7 @@ class ClusterComCheck:
|
||||||
tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j))
|
tdLog.debug("check %s_%d that status is ready "%(dbNameIndex,j))
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
print(query_status)
|
# print(query_status)
|
||||||
count+=1
|
count+=1
|
||||||
if query_status == dbNumbers:
|
if query_status == dbNumbers:
|
||||||
tdLog.success("we find cluster with %d dnode and check all databases are ready within 5s! " %dbNumbers)
|
tdLog.success("we find cluster with %d dnode and check all databases are ready within 5s! " %dbNumbers)
|
||||||
|
|
|
@ -125,7 +125,6 @@ class ClusterComCreate:
|
||||||
|
|
||||||
def create_databases(self,tsql,dbNameIndex,dbNumbers,dropFlag=1,vgroups=4,replica=1):
|
def create_databases(self,tsql,dbNameIndex,dbNumbers,dropFlag=1,vgroups=4,replica=1):
|
||||||
for i in range(dbNumbers):
|
for i in range(dbNumbers):
|
||||||
print(dbNumbers)
|
|
||||||
if dropFlag == 1:
|
if dropFlag == 1:
|
||||||
tsql.execute("drop database if exists %s_%d"%(dbNameIndex,i))
|
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))
|
tsql.execute("create database if not exists %s_%d vgroups %d replica %d"%(dbNameIndex,i, vgroups, replica))
|
||||||
|
|
|
@ -121,7 +121,7 @@ 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
|
||||||
# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.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
|
# 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
|
# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3
|
||||||
|
|
Loading…
Reference in New Issue