未验证 提交 1ec4d3bc 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #18586 from taosdata/TD-20251

test:modify base version from 3.0.1.0 to 3.0.1.8  in compatibility  testcase
...@@ -4,7 +4,7 @@ import sys ...@@ -4,7 +4,7 @@ import sys
import os import os
import time import time
from pathlib import Path
from util.log import * from util.log import *
from util.sql import * from util.sql import *
from util.cases import * from util.cases import *
...@@ -13,162 +13,167 @@ from util.dnodes import TDDnodes ...@@ -13,162 +13,167 @@ from util.dnodes import TDDnodes
from util.dnodes import TDDnode from util.dnodes import TDDnode
from util.cluster import * from util.cluster import *
BASEVERSION = "3.0.1.8"
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' '''
3.0 data compatibility test 3.0 data compatibility test
case1: basedata version is 3.0.1.0 case1: basedata version is 3.0.1.8
''' '''
return return
def init(self, conn, logSql, replicaVar=1): def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar) self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor()) tdSql.init(conn.cursor())
def getBuildPath(self): def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")] projPath = selfPath[:selfPath.find("community")]
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files or "taosd.exe" in files): if ("taosd" in files or "taosd.exe" in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")] buildPath = root[:len(root)-len("/build/bin")]
break break
return buildPath return buildPath
def getCfgPath(self): def getCfgPath(self):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
cfgPath = buildPath + "/../sim/dnode1/cfg/" cfgPath = buildPath + "/../sim/dnode1/cfg/"
else: else:
cfgPath = buildPath + "/../sim/dnode1/cfg/" cfgPath = buildPath + "/../sim/dnode1/cfg/"
return cfgPath return cfgPath
def installTaosd(self,bPath,cPath): def installTaosd(self,bPath,cPath):
# os.system(f"rmtaos && mkdir -p {self.getBuildPath()}/build/lib/temp && mv {self.getBuildPath()}/build/lib/libtaos.so* {self.getBuildPath()}/build/lib/temp/ ") # os.system(f"rmtaos && mkdir -p {self.getBuildPath()}/build/lib/temp && mv {self.getBuildPath()}/build/lib/libtaos.so* {self.getBuildPath()}/build/lib/temp/ ")
# os.system(f" mv {bPath}/build {bPath}/build_bak ") # os.system(f" mv {bPath}/build {bPath}/build_bak ")
# os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so {self.getBuildPath()}/build/lib/libtaos.so_bak ") # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so {self.getBuildPath()}/build/lib/libtaos.so_bak ")
# os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ") # os.system(f"mv {self.getBuildPath()}/build/lib/libtaos.so.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ")
packagePath="/usr/local/src/" packagePath = "/usr/local/src/"
packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz"
os.system(f"cd {packagePath} && tar xvf TDengine-server-3.0.1.0-Linux-x64.tar.gz && cd TDengine-server-3.0.1.0 && ./install.sh -e no " ) packageName = "TDengine-server-"+ BASEVERSION + "-Linux-x64.tar.gz"
tdDnodes.stop(1) packageTPath = packageName.split("-Linux-")[0]
print(f"start taosd: nohup taosd -c {cPath} & ") my_file = Path(f"{packagePath}/{packageName}")
os.system(f" nohup taosd -c {cPath} & " ) if not my_file.exists():
sleep(1) print(f"{packageName} is not exists")
os.system(f"cd {packagePath} && wget https://www.tdengine.com/assets-download/3.0/{packageName}")
else:
print(f"{packageName} has been exists")
def buildTaosd(self,bPath): os.system(f"cd {packagePath} && tar xvf {packageName} && cd {packageTPath} && ./install.sh -e no " )
# os.system(f"mv {bPath}/build_bak {bPath}/build ") tdDnodes.stop(1)
os.system(f" cd {bPath} && make install ") print(f"start taosd: nohup taosd -c {cPath} & ")
os.system(f" nohup taosd -c {cPath} & " )
sleep(5)
def run(self):
print(f"start taosd run")
bPath=self.getBuildPath()
cPath=self.getCfgPath() def buildTaosd(self,bPath):
dbname = "test" # os.system(f"mv {bPath}/build_bak {bPath}/build ")
stb = f"{dbname}.meters" os.system(f" cd {bPath} && make install ")
self.installTaosd(bPath,cPath)
os.system("echo 'debugFlag 143' > /etc/taos/taos.cfg ")
os.system("echo ' supportVnodes 256' > /etc/taos/taos.cfg ") def run(self):
tableNumbers=100 bPath=self.getBuildPath()
recordNumbers1=100 cPath=self.getCfgPath()
recordNumbers2=1000 dbname = "test"
#tdsqlF=tdCom.newTdSql() stb = f"{dbname}.meters"
#print(tdsqlF) self.installTaosd(bPath,cPath)
os.system("echo 'debugFlag 143' > /etc/taos/taos.cfg ")
oldServerVersion = '3.0.1.0' tableNumbers=100
#tdsqlF.query(f"SELECT SERVER_VERSION();") recordNumbers1=100
#print(tdsqlF.query(f"SELECT SERVER_VERSION();")) recordNumbers2=1000
#oldServerVersion=tdsqlF.queryResult[0][0] # tdsqlF=tdCom.newTdSql()
#tdLog.info(f"Base server version is {oldServerVersion}") # print(tdsqlF)
#tdsqlF.query(f"SELECT CLIENT_VERSION();") # tdsqlF.query(f"SELECT SERVER_VERSION();")
# # print(tdsqlF.query(f"SELECT SERVER_VERSION();"))
## the oldClientVersion can't be updated in the same python process,so the version is new compiled verison # oldServerVersion=tdsqlF.queryResult[0][0]
#oldClientVersion=tdsqlF.queryResult[0][0] # tdLog.info(f"Base server version is {oldServerVersion}")
# tdsqlF.query(f"SELECT CLIENT_VERSION();")
#tdLog.info(f"Base client version is {oldClientVersion}") # # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison
# oldClientVersion=tdsqlF.queryResult[0][0]
tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}") # tdLog.info(f"Base client version is {oldClientVersion}")
tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") # baseVersion = "3.0.1.8"
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}")
sleep(3) tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
# tdsqlF.query(f"select count(*) from {stb}") sleep(3)
# tdsqlF.checkData(0,0,tableNumbers*recordNumbers1)
os.system("pkill taosd") # tdsqlF.query(f"select count(*) from {stb}")
sleep(2) # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1)
os.system("pkill taosd")
print(f"start taosd: nohup taosd -c {cPath} & ") sleep(2)
os.system(f" nohup taosd -c {cPath} & " )
sleep(10) print(f"start taosd: nohup taosd -c {cPath} & ")
tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ") os.system(f" nohup taosd -c {cPath} & " )
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y") sleep(10)
os.system("pkill -9 taosd") tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ")
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y")
os.system("pkill -9 taosd")
tdLog.printNoPrefix("==========step2:update new version ")
self.buildTaosd(bPath)
tdDnodes.start(1) tdLog.printNoPrefix("==========step2:update new version ")
sleep(1) self.buildTaosd(bPath)
tdsql=tdCom.newTdSql() tdDnodes.start(1)
print(tdsql) sleep(1)
tdsql=tdCom.newTdSql()
print(tdsql)
tdsql.query(f"SELECT SERVER_VERSION();")
nowServerVersion=tdsql.queryResult[0][0]
tdLog.info(f"New server version is {nowServerVersion}") tdsql.query(f"SELECT SERVER_VERSION();")
tdsql.query(f"SELECT CLIENT_VERSION();") nowServerVersion=tdsql.queryResult[0][0]
nowClientVersion=tdsql.queryResult[0][0] tdLog.info(f"New server version is {nowServerVersion}")
tdLog.info(f"New client version is {nowClientVersion}") tdsql.query(f"SELECT CLIENT_VERSION();")
nowClientVersion=tdsql.queryResult[0][0]
tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") tdLog.info(f"New client version is {nowClientVersion}")
tdsql.query(f"select count(*) from {stb}")
tdsql.checkData(0,0,tableNumbers*recordNumbers1) tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") tdsql.query(f"select count(*) from {stb}")
tdsql.query(f"select count(*) from {stb}") tdsql.checkData(0,0,tableNumbers*recordNumbers1)
tdsql.checkData(0,0,tableNumbers*recordNumbers2) os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
tdsql.query(f"select count(*) from {stb}")
tdsql=tdCom.newTdSql() tdsql.checkData(0,0,tableNumbers*recordNumbers2)
tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") tdsql.query(f"select count(*) from db4096.stb0")
tdsql.execute("drop database if exists db") tdsql.checkData(0,0,50000)
tdsql.execute("create database db")
tdsql.execute("use db") tdsql=tdCom.newTdSql()
tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);") tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542")
tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);") tdsql.execute("drop database if exists db")
tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdsql.execute("create database db")
tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdsql.execute("use db")
tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);") tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
tdsql.query("select * from db.ct3") tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);")
tdsql.checkData(0,1,13) tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);")
tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);")
tdsql.query("select * from db.ct4") tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);")
tdsql.checkData(0,1,14) tdsql.query("select * from db.ct3")
tdsql.query("describe information_schema.ins_databases;") tdsql.checkData(0,1,13)
qRows=tdsql.queryRows tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
for i in range(qRows) : tdsql.query("select * from db.ct4")
if tdsql.queryResult[i][0]=="retentions" : tdsql.checkData(0,1,14)
return True tdsql.query("describe information_schema.ins_databases;")
else: qRows=tdsql.queryRows
return False for i in range(qRows) :
def stop(self): if tdsql.queryResult[i][0]=="retentions" :
tdSql.close() return True
tdLog.success(f"{__file__} successfully executed") else:
return False
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册