提交 78b0844a 编写于 作者: haoranc's avatar haoranc

test:modify base version from 3.0.1.0 to 3.0.1.8 in compatibility testcase

上级 f76441ba
...@@ -3,8 +3,7 @@ import taos ...@@ -3,8 +3,7 @@ import taos
import sys 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 *
...@@ -15,159 +14,165 @@ from util.cluster import * ...@@ -15,159 +14,165 @@ from util.cluster import *
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.0
''' '''
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" baseVersion = "3.0.1.8"
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(1)
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 ")
tableNumbers=100 def run(self):
recordNumbers1=100 bPath=self.getBuildPath()
recordNumbers2=1000 cPath=self.getCfgPath()
#tdsqlF=tdCom.newTdSql() dbname = "test"
#print(tdsqlF) stb = f"{dbname}.meters"
self.installTaosd(bPath,cPath)
oldServerVersion = '3.0.1.0' os.system("echo 'debugFlag 143' > /etc/taos/taos.cfg ")
#tdsqlF.query(f"SELECT SERVER_VERSION();") tableNumbers=100
#print(tdsqlF.query(f"SELECT SERVER_VERSION();")) recordNumbers1=100
#oldServerVersion=tdsqlF.queryResult[0][0] recordNumbers2=1000
#tdLog.info(f"Base server version is {oldServerVersion}") # tdsqlF=tdCom.newTdSql()
#tdsqlF.query(f"SELECT CLIENT_VERSION();") # print(tdsqlF)
# # tdsqlF.query(f"SELECT SERVER_VERSION();")
## the oldClientVersion can't be updated in the same python process,so the version is new compiled verison # print(tdsqlF.query(f"SELECT SERVER_VERSION();"))
#oldClientVersion=tdsqlF.queryResult[0][0] # oldServerVersion=tdsqlF.queryResult[0][0]
# tdLog.info(f"Base server version is {oldServerVersion}")
#tdLog.info(f"Base client version is {oldClientVersion}") # tdsqlF.query(f"SELECT CLIENT_VERSION();")
tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}") # # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison
tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") # oldClientVersion=tdsqlF.queryResult[0][0]
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") # tdLog.info(f"Base client version is {oldClientVersion}")
sleep(3) oldServerVersion = "3.0.1.0"
tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}")
# tdsqlF.query(f"select count(*) from {stb}") tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
# tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
os.system("pkill taosd") sleep(3)
sleep(2)
# tdsqlF.query(f"select count(*) from {stb}")
print(f"start taosd: nohup taosd -c {cPath} & ") # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1)
os.system(f" nohup taosd -c {cPath} & " ) os.system("pkill taosd")
sleep(10) sleep(2)
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") print(f"start taosd: nohup taosd -c {cPath} & ")
os.system("pkill -9 taosd") os.system(f" nohup taosd -c {cPath} & " )
sleep(10)
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")
tdLog.printNoPrefix("==========step2:update new version ") os.system("pkill -9 taosd")
self.buildTaosd(bPath)
tdDnodes.start(1)
sleep(1)
tdsql=tdCom.newTdSql() tdLog.printNoPrefix("==========step2:update new version ")
print(tdsql) self.buildTaosd(bPath)
tdDnodes.start(1)
sleep(1)
tdsql.query(f"SELECT SERVER_VERSION();") tdsql=tdCom.newTdSql()
nowServerVersion=tdsql.queryResult[0][0] print(tdsql)
tdLog.info(f"New server version is {nowServerVersion}")
tdsql.query(f"SELECT CLIENT_VERSION();")
nowClientVersion=tdsql.queryResult[0][0] tdsql.query(f"SELECT SERVER_VERSION();")
tdLog.info(f"New client version is {nowClientVersion}") nowServerVersion=tdsql.queryResult[0][0]
tdLog.info(f"New server version is {nowServerVersion}")
tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") tdsql.query(f"SELECT CLIENT_VERSION();")
tdsql.query(f"select count(*) from {stb}") nowClientVersion=tdsql.queryResult[0][0]
tdsql.checkData(0,0,tableNumbers*recordNumbers1) tdLog.info(f"New client version is {nowClientVersion}")
os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
tdsql.query(f"select count(*) from {stb}") tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
tdsql.checkData(0,0,tableNumbers*recordNumbers2) tdsql.query(f"select count(*) from {stb}")
tdsql.checkData(0,0,tableNumbers*recordNumbers1)
tdsql=tdCom.newTdSql() os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") tdsql.query(f"select count(*) from {stb}")
tdsql.execute("drop database if exists db") tdsql.checkData(0,0,tableNumbers*recordNumbers2)
tdsql.execute("create database db") tdsql.query(f"select count(*) from db4096.stb0")
tdsql.execute("use db") tdsql.checkData(0,0,50000)
tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);") tdsql=tdCom.newTdSql()
tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542")
tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdsql.execute("drop database if exists db")
tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);") tdsql.execute("create database db")
tdsql.query("select * from db.ct3") tdsql.execute("use db")
tdsql.checkData(0,1,13) tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);")
tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);")
tdsql.query("select * from db.ct4") tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);")
tdsql.checkData(0,1,14) tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);")
tdsql.query("describe information_schema.ins_databases;") tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);")
qRows=tdsql.queryRows tdsql.query("select * from db.ct3")
for i in range(qRows) : tdsql.checkData(0,1,13)
if tdsql.queryResult[i][0]=="retentions" : tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
return True tdsql.query("select * from db.ct4")
else: tdsql.checkData(0,1,14)
return False tdsql.query("describe information_schema.ins_databases;")
def stop(self): qRows=tdsql.queryRows
tdSql.close() for i in range(qRows) :
tdLog.success(f"{__file__} successfully executed") if tdsql.queryResult[i][0]=="retentions" :
return True
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.
先完成此消息的编辑!
想要评论请 注册