From 42a326fbdd17e664088eb42dc283cb96039d13b9 Mon Sep 17 00:00:00 2001 From: tomchon Date: Thu, 15 Sep 2022 10:45:41 +0800 Subject: [PATCH 1/6] test:update jenkins of ci --- Jenkinsfile2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index d7df07f06a..6a4a2156e5 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -218,12 +218,12 @@ def pre_test_win(){ if (env.CHANGE_URL =~ /\/TDengine\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% git remote prune origin - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% @@ -236,7 +236,7 @@ def pre_test_win(){ } else if (env.CHANGE_URL =~ /\/TDinternal\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull + git pull ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_INTERNAL_ROOT% From 0517996b97f20d87091165004b80dfc7f84c6a2f Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 17:20:04 +0800 Subject: [PATCH 2/6] test:add testcase of data Compatibility --- tests/parallel_test/run_container.sh | 10 +- tests/system-test/0-others/compatibility.py | 138 ++++++++++++++++++++ 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 tests/system-test/0-others/compatibility.py diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index f0ee9be46f..3a7193b39c 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -79,9 +79,11 @@ fi ulimit -c unlimited TMP_DIR=$WORKDIR/tmp - +SOURCEDIR=$WORKDIR/src MOUNT_DIR="" +packageName="TDengine-server-3.0.1.0-Linux-x64.tar.gz" rm -rf ${TMP_DIR}/thread_volume/$thread_no/sim +mkdir -p $SOURCEDIR mkdir -p ${TMP_DIR}/thread_volume/$thread_no/sim/tsim mkdir -p ${TMP_DIR}/thread_volume/$thread_no/coredump rm -rf ${TMP_DIR}/thread_volume/$thread_no/coredump/* @@ -90,6 +92,11 @@ if [ ! -d "${TMP_DIR}/thread_volume/$thread_no/$exec_dir" ]; then echo "cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/" cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/ fi + +if [ ! -d "${SOURCEDIR}/${packageName}" ]; then + wget -P ${SOURCEDIR} https://taosdata.com/assets-download/3.0/${packageName} +fi + MOUNT_DIR="$TMP_DIR/thread_volume/$thread_no/$exec_dir:$CONTAINER_TESTDIR/tests/$exec_dir" echo "$thread_no -> ${exec_dir}:$cmd" coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname` @@ -97,6 +104,7 @@ coredump_dir=`cat /proc/sys/kernel/core_pattern | xargs dirname` docker run \ -v $REP_MOUNT_PARAM \ -v $MOUNT_DIR \ + -v ${SOURCEDIR}:/usr/local/src/ \ -v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \ -v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \ -v $WORKDIR/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \ diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py new file mode 100644 index 0000000000..8636274ca3 --- /dev/null +++ b/tests/system-test/0-others/compatibility.py @@ -0,0 +1,138 @@ +from urllib.parse import uses_relative +import taos +import sys +import os +import time + + +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.cluster import * + + +class TDTestCase: + def caseDescription(self): + ''' + 3.0 data compatibility test + case1: basedata version is 3.0.1.0 + ''' + return + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + + + 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 + + def getCfgPath(self): + buildPath = self.getBuildPath() + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + cfgPath = buildPath + "/../community/sim/dnode1/cfg/" + else: + cfgPath = buildPath + "/../sim/dnode1/cfg/" + + return cfgPath + + 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" 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.1 {self.getBuildPath()}/build/lib/libtaos.so.1_bak ") + + 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 " ) + tdDnodes.stop(1) + print(f"start taosd: nohup taosd -c {cPath} & ") + os.system(f" nohup taosd -c {cPath} & " ) + sleep(1) + + + + def buildTaosd(self,bPath): + # os.system(f"mv {bPath}/build_bak {bPath}/build ") + os.system(f" cd {bPath} && make install ") + + + def run(self): + print(f"buildpath:{self.getBuildPath()}") + bPath=self.getBuildPath() + cPath=self.getCfgPath() + dbname = "test" + stb = f"{dbname}.meters" + self.installTaosd(bPath,cPath) + tableNumbers=100 + recordNumbers1=100 + recordNumbers2=1000 + # print(tdSql) + tdsqlF=tdCom.newTdSql() + print(tdsqlF) + tdsqlF.query(f"SELECT SERVER_VERSION();") + print(tdsqlF.query(f"SELECT SERVER_VERSION();")) + oldServerVersion=tdsqlF.queryResult[0][0] + tdLog.info(f"Base server version is {oldServerVersion}") + tdsqlF.query(f"SELECT CLIENT_VERSION();") + # the oldClientVersion can't be updated in the same python process,so the version is new compiled verison + oldClientVersion=tdsqlF.queryResult[0][0] + tdLog.info(f"Base client version is {oldClientVersion}") + + tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{oldServerVersion}") + tdLog.info(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") + os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ") + sleep(3) + + # tdsqlF.query(f"select count(*) from {stb}") + # tdsqlF.checkData(0,0,tableNumbers*recordNumbers1) + os.system("pkill taosd") + sleep(1) + + tdLog.printNoPrefix("==========step2:update new version ") + self.buildTaosd(bPath) + tdDnodes.start(1) + sleep(1) + tdsql_new=tdCom.newTdSql() + print(tdsql_new) + + + tdsql_new.query(f"SELECT SERVER_VERSION();") + nowServerVersion=tdsql_new.queryResult[0][0] + tdLog.info(f"New server version is {nowServerVersion}") + tdsql_new.query(f"SELECT CLIENT_VERSION();") + nowClientVersion=tdsql_new.queryResult[0][0] + tdLog.info(f"New client version is {nowClientVersion}") + + tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") + tdsql_new.query(f"select count(*) from {stb}") + tdsql_new.checkData(0,0,tableNumbers*recordNumbers1) + os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") + tdsql_new.query(f"select count(*) from {stb}") + tdsql_new.checkData(0,0,tableNumbers*recordNumbers2) + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From 5c7997be4b17a21cb30f887a7c6f33bd88cf31f6 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 18:17:23 +0800 Subject: [PATCH 3/6] test:verify backticks with atuo creating tables --- tests/system-test/0-others/compatibility.py | 30 ++++++++++++--------- tests/system-test/fulltest.sh | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 8636274ca3..4dae6f06cf 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -76,7 +76,6 @@ class TDTestCase: def run(self): - print(f"buildpath:{self.getBuildPath()}") bPath=self.getBuildPath() cPath=self.getCfgPath() dbname = "test" @@ -85,7 +84,6 @@ class TDTestCase: tableNumbers=100 recordNumbers1=100 recordNumbers2=1000 - # print(tdSql) tdsqlF=tdCom.newTdSql() print(tdsqlF) tdsqlF.query(f"SELECT SERVER_VERSION();") @@ -111,24 +109,32 @@ class TDTestCase: self.buildTaosd(bPath) tdDnodes.start(1) sleep(1) - tdsql_new=tdCom.newTdSql() - print(tdsql_new) + tdsql=tdCom.newTdSql() + print(tdsql) - tdsql_new.query(f"SELECT SERVER_VERSION();") - nowServerVersion=tdsql_new.queryResult[0][0] + tdsql.query(f"SELECT SERVER_VERSION();") + nowServerVersion=tdsql.queryResult[0][0] tdLog.info(f"New server version is {nowServerVersion}") - tdsql_new.query(f"SELECT CLIENT_VERSION();") - nowClientVersion=tdsql_new.queryResult[0][0] + tdsql.query(f"SELECT CLIENT_VERSION();") + nowClientVersion=tdsql.queryResult[0][0] tdLog.info(f"New client version is {nowClientVersion}") tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}") - tdsql_new.query(f"select count(*) from {stb}") - tdsql_new.checkData(0,0,tableNumbers*recordNumbers1) + tdsql.query(f"select count(*) from {stb}") + tdsql.checkData(0,0,tableNumbers*recordNumbers1) os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ") - tdsql_new.query(f"select count(*) from {stb}") - tdsql_new.checkData(0,0,tableNumbers*recordNumbers2) + tdsql.query(f"select count(*) from {stb}") + tdsql.checkData(0,0,tableNumbers*recordNumbers2) + tdsql=tdCom.newTdSql() + tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") + tdsql.execute("create database db") + tdsql.execute("use db") + tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);") + tdsql.execute("insert into db.ct1 using db.stb1 TAGS(9) values(now(),11);") + tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") + tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") def stop(self): tdSql.close() diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index f4a5c22d39..2f5cf5536e 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -17,6 +17,7 @@ python3 ./test.py -f 0-others/udf_cfg2.py python3 ./test.py -f 0-others/sysinfo.py python3 ./test.py -f 0-others/user_control.py python3 ./test.py -f 0-others/fsync.py +python3 ./test.py -f 0-others/compatibility.py python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py From 9c84d59297a5e5835bdf0ee3e5b90b2e3578dfe5 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 19:52:10 +0800 Subject: [PATCH 4/6] test:add testcase of data Compatibility --- tests/parallel_test/run_container.sh | 2 +- tests/system-test/0-others/compatibility.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/parallel_test/run_container.sh b/tests/parallel_test/run_container.sh index 3a7193b39c..bb57f238f0 100755 --- a/tests/parallel_test/run_container.sh +++ b/tests/parallel_test/run_container.sh @@ -93,7 +93,7 @@ if [ ! -d "${TMP_DIR}/thread_volume/$thread_no/$exec_dir" ]; then cp -rf ${REPDIR}/tests/$subdir ${TMP_DIR}/thread_volume/$thread_no/ fi -if [ ! -d "${SOURCEDIR}/${packageName}" ]; then +if [ ! -f "${SOURCEDIR}/${packageName}" ]; then wget -P ${SOURCEDIR} https://taosdata.com/assets-download/3.0/${packageName} fi diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 4dae6f06cf..2b059615e9 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -129,12 +129,22 @@ class TDTestCase: tdsql=tdCom.newTdSql() tdLog.printNoPrefix(f"==========step4:verify backticks in taos Sql-TD18542") + tdsql.execute("drop database if exists db") tdsql.execute("create database db") tdsql.execute("use db") tdsql.execute("create stable db.stb1 (ts timestamp, c1 int) tags (t1 int);") - tdsql.execute("insert into db.ct1 using db.stb1 TAGS(9) values(now(),11);") + tdsql.execute("insert into db.ct1 using db.stb1 TAGS(1) values(now(),11);") tdsql.error(" insert into `db.ct2` using db.stb1 TAGS(9) values(now(),11);") tdsql.error(" insert into db.`db.ct2` using db.stb1 TAGS(9) values(now(),11);") + tdsql.execute("insert into `db`.ct3 using db.stb1 TAGS(3) values(now(),13);") + tdsql.query("select * from db.ct3") + tdsql.checkData(0,1,13) + tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);") + tdsql.query("select * from db.ct4") + tdsql.checkData(0,1,14) + tdsql.query("describe information_schema.ins_databases;") + # for i in tdsql.queryResult[i][0]: + # tdsql.checkData(0,1,13) def stop(self): tdSql.close() From 96eec9f47a9b89eb14949a51602ffc1b151bd819 Mon Sep 17 00:00:00 2001 From: tomchon Date: Tue, 20 Sep 2022 22:24:33 +0800 Subject: [PATCH 5/6] test:update jenkins of ci --- Jenkinsfile2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 6a4a2156e5..b95b3ff86b 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -218,12 +218,12 @@ def pre_test_win(){ if (env.CHANGE_URL =~ /\/TDengine\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% git remote prune origin - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_COMMUNITY_ROOT% @@ -236,7 +236,7 @@ def pre_test_win(){ } else if (env.CHANGE_URL =~ /\/TDinternal\//) { bat ''' cd %WIN_INTERNAL_ROOT% - git pull ''' + env.CHANGE_TARGET + ''' + git pull origin ''' + env.CHANGE_TARGET + ''' ''' bat ''' cd %WIN_INTERNAL_ROOT% From e7526a081b5ac5139b9d5d33bd34900b2c4da14b Mon Sep 17 00:00:00 2001 From: tomchon Date: Wed, 21 Sep 2022 16:26:43 +0800 Subject: [PATCH 6/6] test:modify testcase of data Compatibility --- tests/system-test/0-others/compatibility.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/system-test/0-others/compatibility.py b/tests/system-test/0-others/compatibility.py index 2b059615e9..25b023bb76 100644 --- a/tests/system-test/0-others/compatibility.py +++ b/tests/system-test/0-others/compatibility.py @@ -48,7 +48,7 @@ class TDTestCase: selfPath = os.path.dirname(os.path.realpath(__file__)) if ("community" in selfPath): - cfgPath = buildPath + "/../community/sim/dnode1/cfg/" + cfgPath = buildPath + "/../sim/dnode1/cfg/" else: cfgPath = buildPath + "/../sim/dnode1/cfg/" @@ -143,9 +143,12 @@ class TDTestCase: tdsql.query("select * from db.ct4") tdsql.checkData(0,1,14) tdsql.query("describe information_schema.ins_databases;") - # for i in tdsql.queryResult[i][0]: - # tdsql.checkData(0,1,13) - + qRows=tdsql.queryRows + for i in range(qRows) : + if tdsql.queryResult[i][0]=="retentions" : + return True + else: + return False def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed")