提交 5ce28627 编写于 作者: C Cary Xu

Merge branch 'develop' into hotfix/TS-784-D

......@@ -583,10 +583,15 @@ pipeline {
timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
cd ${WKC}/tests
./test-all.sh develop-test
'''
sh '''
date
cd ${WKC}/tests
./test-all.sh b6fq
date'''
}
}
}
......@@ -596,6 +601,10 @@ pipeline {
timeout(time: 55, unit: 'MINUTES'){
pre_test()
sh '''
cd ${WKC}/tests
./test-all.sh system-test
'''
sh '''
date
cd ${WKC}/tests
./test-all.sh b7fq
......
......@@ -557,7 +557,7 @@ KILL STREAM <stream-id>;
TDengine启动后,会自动创建一个监测数据库log,并自动将服务器的CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入该数据库。TDengine还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息记录下来存放在log库里。系统管理员可以从CLI直接查看这个数据库,也可以在WEB通过图形化界面查看这些监测信息。
这些监测信息的采集缺省是打开的,但可以修改配置文件里的选项enableMonitor将其关闭或打开。
这些监测信息的采集缺省是打开的,但可以修改配置文件里的选项monitor将其关闭或打开。
### TDinsight - 使用监控数据库 + Grafana 对 TDengine 进行监控的解决方案
......
Subproject commit 26f90b549f6e113ef3d275775062e674b0119645
Subproject commit 02837ce9e257aec65ba2995c6bebd72952f710a2
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
ret = tdSql.execute('create table tb (ts timestamp, speed int)')
insertRows = 10
tdLog.info("insert %d rows" % (insertRows))
for i in range(0, insertRows):
ret = tdSql.execute(
'insert into tb values (now + %dm, %d)' %
(i, i))
tdLog.info("insert earlier data")
tdSql.execute('insert into tb values (now - 5m , 10)')
tdSql.execute('insert into tb values (now - 6m , 10)')
tdSql.execute('insert into tb values (now - 7m , 10)')
tdSql.execute('insert into tb values (now - 8m , 10)')
tdSql.query("select * from tb")
tdSql.checkRows(insertRows + 4)
# test case for https://jira.taosdata.com:18080/browse/TD-3716:
tdSql.error("insert into tb(now, 1)")
# test case for TD-10717
tdSql.error("insert into tb values(now,1),,(now+1s,1)")
tdSql.execute("insert into tb values(now+2s,1),(now+3s,1),(now+4s,1)")
tdSql.query("select * from tb")
tdSql.checkRows(insertRows + 4 +3)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
python3 test.py -f 1-insert/0-sql/basic.py
\ No newline at end of file
#!/usr/bin/python
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# install pip
# pip install src/connector/python/
# -*- coding: utf-8 -*-
import sys
import getopt
import subprocess
import time
from distutils.log import warn as printf
from fabric2 import Connection
sys.path.append("../pytest")
from util.log import *
from util.dnodes import *
from util.cases import *
import taos
if __name__ == "__main__":
fileName = "all"
deployPath = ""
masterIp = ""
testCluster = False
valgrind = 0
logSql = True
stop = 0
restart = False
windows = 0
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrw', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'windows'])
for key, value in opts:
if key in ['-h', '--help']:
tdLog.printNoPrefix(
'A collection of test cases written using Python')
tdLog.printNoPrefix('-f Name of test case file written by Python')
tdLog.printNoPrefix('-p Deploy Path for Simulator')
tdLog.printNoPrefix('-m Master Ip for Simulator')
tdLog.printNoPrefix('-l <True:False> logSql Flag')
tdLog.printNoPrefix('-s stop All dnodes')
tdLog.printNoPrefix('-c Test Cluster Flag')
tdLog.printNoPrefix('-g valgrind Test Flag')
tdLog.printNoPrefix('-r taosd restart test')
tdLog.printNoPrefix('-w taos on windows')
sys.exit(0)
if key in ['-r', '--restart']:
restart = True
if key in ['-f', '--file']:
fileName = value
if key in ['-p', '--path']:
deployPath = value
if key in ['-m', '--master']:
masterIp = value
if key in ['-l', '--logSql']:
if (value.upper() == "TRUE"):
logSql = True
elif (value.upper() == "FALSE"):
logSql = False
else:
tdLog.printNoPrefix("logSql value %s is invalid" % logSql)
sys.exit(0)
if key in ['-c', '--cluster']:
testCluster = True
if key in ['-g', '--valgrind']:
valgrind = 1
if key in ['-s', '--stop']:
stop = 1
if key in ['-w', '--windows']:
windows = 1
if (stop != 0):
if (valgrind == 0):
toBeKilled = "taosd"
else:
toBeKilled = "valgrind.bin"
killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled
processID = subprocess.check_output(psCmd, shell=True)
while(processID):
os.system(killCmd)
time.sleep(1)
processID = subprocess.check_output(psCmd, shell=True)
for port in range(6030, 6041):
usePortPID = "lsof -i tcp:%d | grep LISTEn | awk '{print $2}'" % port
processID = subprocess.check_output(usePortPID, shell=True)
if processID:
killCmd = "kill -TERM %s" % processID
os.system(killCmd)
fuserCmd = "fuser -k -n tcp %d" % port
os.system(fuserCmd)
if valgrind:
time.sleep(2)
tdLog.info('stop All dnodes')
if masterIp == "":
host = '127.0.0.1'
else:
host = masterIp
tdLog.info("Procedures for tdengine deployed in %s" % (host))
if windows:
tdCases.logSql(logSql)
tdLog.info("Procedures for testing self-deployment")
td_clinet = TDSimClient("C:\\TDengine")
td_clinet.deploy()
remote_conn = Connection("root@%s"%host)
with remote_conn.cd('/var/lib/jenkins/workspace/TDinternal/community/tests/pytest'):
remote_conn.run("python3 ./test.py")
conn = taos.connect(
host="%s"%(host),
config=td_clinet.cfgDir)
tdCases.runOneWindows(conn, fileName)
else:
tdDnodes.init(deployPath)
tdDnodes.setTestCluster(testCluster)
tdDnodes.setValgrind(valgrind)
tdDnodes.stopAll()
is_test_framework = 0
key_word = 'tdCases.addLinux'
try:
if key_word in open(fileName).read():
is_test_framework = 1
except:
pass
if is_test_framework:
moduleName = fileName.replace(".py", "").replace("/", ".")
uModule = importlib.import_module(moduleName)
try:
ucase = uModule.TDTestCase()
tdDnodes.deploy(1,ucase.updatecfgDict)
except :
tdDnodes.deploy(1,{})
else:
pass
tdDnodes.deploy(1,{})
tdDnodes.start(1)
tdCases.logSql(logSql)
if testCluster:
tdLog.info("Procedures for testing cluster")
if fileName == "all":
tdCases.runAllCluster()
else:
tdCases.runOneCluster(fileName)
else:
tdLog.info("Procedures for testing self-deployment")
conn = taos.connect(
host,
config=tdDnodes.getSimCfgPath())
if fileName == "all":
tdCases.runAllLinux(conn)
else:
tdCases.runOneWindows(conn, fileName)
if restart:
if fileName == "all":
tdLog.info("not need to query ")
else:
sp = fileName.rsplit(".", 1)
if len(sp) == 2 and sp[1] == "py":
tdDnodes.stopAll()
tdDnodes.start(1)
time.sleep(1)
conn = taos.connect( host, config=tdDnodes.getSimCfgPath())
tdLog.info("Procedures for tdengine deployed in %s" % (host))
tdLog.info("query test after taosd restart")
tdCases.runOneLinux(conn, sp[0] + "_" + "restart.py")
else:
tdLog.info("not need to query")
conn.close()
......@@ -29,6 +29,7 @@ python3 ./test.py -f insert/in_function.py
python3 ./test.py -f insert/modify_column.py
#python3 ./test.py -f insert/line_insert.py
python3 ./test.py -f insert/specialSql.py
python3 ./test.py -f insert/timestamp.py
# timezone
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1607281690000
def run(self):
tdSql.prepare()
# TS-806
tdLog.info("test case for TS-806")
# Case 1
tdSql.execute("create table t1(ts timestamp, c1 int)")
tdSql.execute("insert into t1(c1, ts) values(1, %d)" % self.ts)
tdSql.query("select * from t1")
tdSql.checkRows(1)
# Case 2
tdSql.execute("insert into t1(c1, ts) values(2, %d)(3, %d)" % (self.ts + 1000, self.ts + 2000))
tdSql.query("select * from t1")
tdSql.checkRows(3)
# Case 3
tdSql.execute("create table t2(ts timestamp, c1 timestamp)")
tdSql.execute(" insert into t2(c1, ts) values(%d, %d)" % (self.ts, self.ts + 5000))
tdSql.query("select * from t2")
tdSql.checkRows(1)
tdSql.execute(" insert into t2(c1, ts) values(%d, %d)(%d, %d)" % (self.ts, self.ts + 6000, self.ts + 3000, self.ts + 8000))
tdSql.query("select * from t2")
tdSql.checkRows(3)
# Case 4
tdSql.execute("create table stb(ts timestamp, c1 int, c2 binary(20)) tags(tstag timestamp, t1 int)")
tdSql.execute("insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', %d, 1)" % self.ts)
tdSql.query("select * from stb")
tdSql.checkRows(1)
# Case 5
tdSql.execute("insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', now, 1) tb2(c1, ts) using stb tags(now + 2m, 1000) values(1, now - 1h)")
tdSql.query("select * from stb")
tdSql.checkRows(3)
tdSql.execute(" insert into tb1(c2, ts, c1) using stb(t1, tstag) tags(1, now) values('test', now + 10s, 1) tb2(c1, ts) using stb(tstag) tags(now + 2m) values(1, now - 3h)(2, now - 2h)")
tdSql.query("select * from stb")
tdSql.checkRows(6)
# Case 6
tdSql.execute("create table stb2 (ts timestamp, c1 timestamp, c2 timestamp) tags(t1 timestamp, t2 timestamp)")
tdSql.execute(" insert into tb4(c1, c2, ts) using stb2(t2, t1) tags(now, now + 1h) values(now + 1s, now + 2s, now + 3s)(now -1s, now - 2s, now - 3s) tb5(c2, ts, c1) using stb2(t2) tags(now + 1h) values(now, now, now)")
tdSql.query("select * from stb2")
tdSql.checkRows(3)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -132,6 +132,25 @@ class TDTestCase:
tdSql.error("select top(tbcol1, 12) from st order by ts, tbcol1")
tdSql.error("select top(tbcol1, 2) from st1 group by tbcol1 order by tbcol2")
fun_list = ['avg','count','twa','sum','stddev','leastsquares','min',
'max','first','last','top','bottom','percentile','apercentile',
'last_row','diff','spread','distinct']
key = ['tbol','tagcol']
for i in range(1,15):
for k in key:
for j in fun_list:
if j == 'leastsquares':
pick_func=j+'('+ k + str(i) +',1,1)'
elif j == 'top' or j == 'bottom' : continue
elif j == 'percentile' or j == 'apercentile':
pick_func=j+'('+ k + str(i) +',1)'
else:
pick_func=j+'('+ k + str(i) +')'
sql = 'select %s from st group by %s order by %s' % (pick_func , k+str(i), k+str(i))
tdSql.error(sql)
sql = 'select %s from st6 group by %s order by %s ' % (pick_func , k+str(i), k+str(i))
tdSql.error(sql)
tdSql.query("select top(tbcol1, 2) from st1 group by tbcol2 order by tbcol2")
tdSql.query("select top(tbcol1, 12) from st order by tbcol1, ts")
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
ret = tdSql.execute('create table tb (ts timestamp, speed int)')
insertRows = 10
tdLog.info("insert %d rows" % (insertRows))
for i in range(0, insertRows):
ret = tdSql.execute(
'insert into tb values (now + %dm, %d)' %
(i, i))
tdLog.info("insert earlier data")
tdSql.execute('insert into tb values (now - 5m , 10)')
tdSql.execute('insert into tb values (now - 6m , 10)')
tdSql.execute('insert into tb values (now - 7m , 10)')
tdSql.execute('insert into tb values (now - 8m , 10)')
tdSql.query("select * from tb")
tdSql.checkRows(insertRows + 4)
# test case for https://jira.taosdata.com:18080/browse/TD-3716:
tdSql.error("insert into tb(now, 1)")
# test case for TD-10717
tdSql.error("insert into tb values(now,1),,(now+1s,1)")
tdSql.execute("insert into tb values(now+2s,1),(now+3s,1),(now+4s,1)")
tdSql.query("select * from tb")
tdSql.checkRows(insertRows + 4 +3)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
python3 test.py -f 1-insert/0-sql/basic.py
\ No newline at end of file
#!/usr/bin/python
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# install pip
# pip install src/connector/python/
# -*- coding: utf-8 -*-
import sys
import getopt
import subprocess
import time
from distutils.log import warn as printf
from fabric2 import Connection
sys.path.append("../pytest")
from util.log import *
from util.dnodes import *
from util.cases import *
import taos
if __name__ == "__main__":
fileName = "all"
deployPath = ""
masterIp = ""
testCluster = False
valgrind = 0
logSql = True
stop = 0
restart = False
windows = 0
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrw', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'windows'])
for key, value in opts:
if key in ['-h', '--help']:
tdLog.printNoPrefix(
'A collection of test cases written using Python')
tdLog.printNoPrefix('-f Name of test case file written by Python')
tdLog.printNoPrefix('-p Deploy Path for Simulator')
tdLog.printNoPrefix('-m Master Ip for Simulator')
tdLog.printNoPrefix('-l <True:False> logSql Flag')
tdLog.printNoPrefix('-s stop All dnodes')
tdLog.printNoPrefix('-c Test Cluster Flag')
tdLog.printNoPrefix('-g valgrind Test Flag')
tdLog.printNoPrefix('-r taosd restart test')
tdLog.printNoPrefix('-w taos on windows')
sys.exit(0)
if key in ['-r', '--restart']:
restart = True
if key in ['-f', '--file']:
fileName = value
if key in ['-p', '--path']:
deployPath = value
if key in ['-m', '--master']:
masterIp = value
if key in ['-l', '--logSql']:
if (value.upper() == "TRUE"):
logSql = True
elif (value.upper() == "FALSE"):
logSql = False
else:
tdLog.printNoPrefix("logSql value %s is invalid" % logSql)
sys.exit(0)
if key in ['-c', '--cluster']:
testCluster = True
if key in ['-g', '--valgrind']:
valgrind = 1
if key in ['-s', '--stop']:
stop = 1
if key in ['-w', '--windows']:
windows = 1
if (stop != 0):
if (valgrind == 0):
toBeKilled = "taosd"
else:
toBeKilled = "valgrind.bin"
killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
psCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}'" % toBeKilled
processID = subprocess.check_output(psCmd, shell=True)
while(processID):
os.system(killCmd)
time.sleep(1)
processID = subprocess.check_output(psCmd, shell=True)
for port in range(6030, 6041):
usePortPID = "lsof -i tcp:%d | grep LISTEn | awk '{print $2}'" % port
processID = subprocess.check_output(usePortPID, shell=True)
if processID:
killCmd = "kill -TERM %s" % processID
os.system(killCmd)
fuserCmd = "fuser -k -n tcp %d" % port
os.system(fuserCmd)
if valgrind:
time.sleep(2)
tdLog.info('stop All dnodes')
if masterIp == "":
host = '127.0.0.1'
else:
host = masterIp
tdLog.info("Procedures for tdengine deployed in %s" % (host))
if windows:
tdCases.logSql(logSql)
tdLog.info("Procedures for testing self-deployment")
td_clinet = TDSimClient("C:\\TDengine")
td_clinet.deploy()
remote_conn = Connection("root@%s"%host)
with remote_conn.cd('/var/lib/jenkins/workspace/TDinternal/community/tests/pytest'):
remote_conn.run("python3 ./test.py")
conn = taos.connect(
host="%s"%(host),
config=td_clinet.cfgDir)
tdCases.runOneWindows(conn, fileName)
else:
tdDnodes.init(deployPath)
tdDnodes.setTestCluster(testCluster)
tdDnodes.setValgrind(valgrind)
tdDnodes.stopAll()
is_test_framework = 0
key_word = 'tdCases.addLinux'
try:
if key_word in open(fileName).read():
is_test_framework = 1
except:
pass
if is_test_framework:
moduleName = fileName.replace(".py", "").replace("/", ".")
uModule = importlib.import_module(moduleName)
try:
ucase = uModule.TDTestCase()
tdDnodes.deploy(1,ucase.updatecfgDict)
except :
tdDnodes.deploy(1,{})
else:
pass
tdDnodes.deploy(1,{})
tdDnodes.start(1)
tdCases.logSql(logSql)
if testCluster:
tdLog.info("Procedures for testing cluster")
if fileName == "all":
tdCases.runAllCluster()
else:
tdCases.runOneCluster(fileName)
else:
tdLog.info("Procedures for testing self-deployment")
conn = taos.connect(
host,
config=tdDnodes.getSimCfgPath())
if fileName == "all":
tdCases.runAllLinux(conn)
else:
tdCases.runOneWindows(conn, fileName)
if restart:
if fileName == "all":
tdLog.info("not need to query ")
else:
sp = fileName.rsplit(".", 1)
if len(sp) == 2 and sp[1] == "py":
tdDnodes.stopAll()
tdDnodes.start(1)
time.sleep(1)
conn = taos.connect( host, config=tdDnodes.getSimCfgPath())
tdLog.info("Procedures for tdengine deployed in %s" % (host))
tdLog.info("query test after taosd restart")
tdCases.runOneLinux(conn, sp[0] + "_" + "restart.py")
else:
tdLog.info("not need to query")
conn.close()
......@@ -158,7 +158,13 @@ function runPyCaseOneByOne {
}
function runPyCaseOneByOnefq() {
cd $tests_dir/pytest
if [[ $3 =~ system ]] ; then
cd $tests_dir/system-test
elif [[ $3 =~ develop ]] ; then
cd $tests_dir/develop-test
else
cd $tests_dir/pytest
fi
if [[ $1 =~ full ]] ; then
start=1
end=`sed -n '$=' fulltest.sh`
......@@ -361,6 +367,12 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$2" != "
elif [ "$1" == "p4" ]; then
echo "### run Python_4 test ###"
runPyCaseOneByOnefq p4 1
elif [ "$1" == "system-test" ]; then
echo "### run system-test test ###"
runPyCaseOneByOnefq full 1 system
elif [ "$1" == "develop-test" ]; then
echo "### run develop-test test ###"
runPyCaseOneByOnefq full 1 develop
elif [ "$1" == "b2" ] || [ "$1" == "b3" ]; then
exit $(($totalFailed + $totalPyFailed))
elif [ "$1" == "smoke" ] || [ -z "$1" ]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册