feat: with new feature -B option to run taosadapter

This commit is contained in:
Alex Duan 2025-02-04 10:26:20 +08:00
parent e2031c3991
commit 63dc04d2de
10 changed files with 43 additions and 118 deletions

View File

@ -113,10 +113,11 @@ if __name__ == "__main__":
previousCluster = False
level = 1
disk = 1
taosAdapter = False
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RWU:n:i:aPL:D:', [
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RWBU:n:i:aPL:D:', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums',
'queryPolicy','createDnodeNums','restful','websocket','adaptercfgupdate','replicaVar','independentMnode',"asan",'previous','level','disk'])
'queryPolicy','createDnodeNums','restful','websocket','adapter','adaptercfgupdate','replicaVar','independentMnode',"asan",'previous','level','disk'])
for key, value in opts:
if key in ['-h', '--help']:
tdLog.printNoPrefix(
@ -145,7 +146,7 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.')
tdLog.printNoPrefix('-L set multiple level number. range 1 ~ 3')
tdLog.printNoPrefix('-D set disk number on each level. range 1 ~ 10')
tdLog.printNoPrefix('-B start taosadapter process')
sys.exit(0)
if key in ['-r', '--restart']:
@ -238,11 +239,14 @@ if __name__ == "__main__":
if key in ['-D', '--disk']:
disk = value
if key in ['-B']:
taosAdapter = True
#
# do exeCmd command
#
if not execCmd == "":
if restful or websocket:
if taosAdapter or taosAdapter or restful or websocket:
tAdapter.init(deployPath)
else:
tdDnodes.init(deployPath)
@ -281,7 +285,7 @@ if __name__ == "__main__":
if valgrind:
time.sleep(2)
if restful or websocket:
if taosAdapter or restful or websocket:
toBeKilled = "taosadapter"
# killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
@ -377,7 +381,7 @@ if __name__ == "__main__":
tdDnodes.deploy(1,updateCfgDict)
tdDnodes.start(1)
tdCases.logSql(logSql)
if restful or websocket:
if taosAdapter or restful or websocket:
tAdapter.deploy(adapter_cfg_dict)
tAdapter.start()
@ -416,7 +420,7 @@ if __name__ == "__main__":
clusterDnodes.starttaosd(dnode.index)
tdCases.logSql(logSql)
if restful or websocket:
if taosAdapter or restful or websocket:
tAdapter.deploy(adapter_cfg_dict)
tAdapter.start()
@ -537,7 +541,7 @@ if __name__ == "__main__":
except:
pass
if restful or websocket:
if taosAdapter or restful or websocket:
tAdapter.init(deployPath, masterIp)
tAdapter.stop(force_kill=True)
@ -548,7 +552,7 @@ if __name__ == "__main__":
tdDnodes.start(1)
tdCases.logSql(logSql)
if restful or websocket:
if taosAdapter or restful or websocket:
tAdapter.deploy(adapter_cfg_dict)
tAdapter.start()
@ -591,7 +595,7 @@ if __name__ == "__main__":
clusterDnodes.starttaosd(dnode.index)
tdCases.logSql(logSql)
if restful or websocket:
if taosAdapter or restful or websocket:
tAdapter.deploy(adapter_cfg_dict)
tAdapter.start()

View File

@ -12,7 +12,7 @@
"sqls":
[{
"sql": "select count(*) from db.stb",
"result": "rest_query_specified"
"result": "./rest_query_specified"
}]
}
}

View File

@ -11,7 +11,7 @@
"sqls": [
{
"sql": "select count(*) from xxxx",
"result": "rest_query_super"
"result": "./rest_query_super"
}
]
}

View File

@ -1,19 +0,0 @@
{
"filetype": "query",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"confirm_parameter_prompt": "no",
"databases": "test",
"query_times": 2,
"query_mode": "taosc",
"kill_slow_query_threshold": 3,
"kill_slow_query_interval": 1,
"specified_table_query": {
"query_interval": 3,
"concurrent": 3,
"sql_file": "./tools/benchmark/basic/json/query-sqls-slow-query.txt"
}
}

View File

@ -16,7 +16,7 @@
"sqls":
[{
"sql": "select count(*) from db.stb",
"result": "taosc_query_specified"
"result": "./taosc_query_specified"
}]
}
}

View File

@ -17,7 +17,7 @@
"sqls": [
{
"sql": "select count(*) from xxxx",
"result": "taosc_query_super"
"result": "./taosc_query_super"
}
]
}

View File

@ -1,60 +0,0 @@
###################################################################
# 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 os
import subprocess
import frame
import frame.etool
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.caseBase import *
from frame import *
class TDTestCase(TBase):
def caseDescription(self):
"""
[TD-11510] taosBenchmark test cases
"""
def run(self):
binPath = etool.benchMarkFile()
cmd = (
"%s -b binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar,binary,nchar -t 2 -n 50000 -I stmt -y > /dev/null"
% binPath
)
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
cmd = 'taos -s "select * from test.meters limit 1000000 offset 0" > /dev/null &'
tdLog.info("%s" % cmd)
os.system("%s" % cmd)
cmd = "%s -f ./tools/benchmark/basic/json/taosc_query-kill-slow-query.json" % binPath
tdLog.info("%s" % cmd)
output = subprocess.check_output(cmd, shell=True).decode("utf-8")
if "KILL QUERY" not in output:
tdLog.info(output)
tdLog.exit("KILL QUERY failed")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -74,10 +74,10 @@ class TDTestCase(TBase):
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
pwd = "Taos@123456"
pwd = "Taos@123456"
tdSql.execute(f"create user test pass '{pwd}'")
os.system(f"%s -utest -p{pwd} -D db -o %s -T 1" % (binPath, self.tmpdir))
os.system(f"%s -D db -o %s -T 1" % (binPath, self.tmpdir))
tdSql.execute("drop database db")
# sys.exit(1)

View File

@ -101,7 +101,7 @@ class TDTestCase(TBase):
print(dbresult)
found = False
for i in range(len(dbresult)):
if dbresult[i][0] == '"beijing"':
if dbresult[i][0] == "beijing":
found = True
break
@ -110,7 +110,7 @@ class TDTestCase(TBase):
tdSql.query("select * from db.st where jtag contains 'location'")
tdSql.checkRows(1)
tdSql.checkData(0, 1, 1)
tdSql.checkData(0, 2, '{"location":"beijing"}')
tdSql.checkData(0, 2, "{'location': 'beijing'}")
tdSql.query("select jtag from db.st")
tdSql.checkRows(3)
@ -118,8 +118,9 @@ class TDTestCase(TBase):
dbresult = tdSql.res
print(dbresult)
found = False
value = {'location': 'beijing'}
for i in range(len(dbresult)):
if dbresult[i][0] == '{"location":"beijing"}':
if dbresult[i][0] == value:
found = True
break

View File

@ -79,11 +79,10 @@
# benchmark 66 cases
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/rest_insert_alltypes_json.py -R
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_sample_csv_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_telnet_insert_alltypes-same-min-max.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/query_json-kill-slow-query.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/default_tmq_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/reuse-exist-stb.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/sml_interlace.py
@ -110,7 +109,7 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/sml_taosjson_insert_alltypes-same-min-max.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert_alltypes-same-min-max.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/bugs.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/bugs.py -B
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_sample_csv_json-subtable.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/query_json-with-error-sqlfile.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosc_insert-retry-json-global.py
@ -126,7 +125,7 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/default_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_sample_csv_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosadapter_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosadapter_json.py -B
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/demo.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-supplement-insert.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/custom_col_tag.py
@ -176,22 +175,22 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/taosdump/native/taosdumpTest2.py
,,y,army,./pytest.sh python3 ./test.py -f tools/taosdump/native/taosdumpTestTypeTinyInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeDouble.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedBigInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpEscapedDb.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpPrimaryKey.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeJson.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedSmallInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedTinyInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeSmallInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBigInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBinary.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeFloat.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBool.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpRetry.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeTinyInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeDouble.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedBigInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpEscapedDb.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpPrimaryKey.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeJson.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedSmallInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedTinyInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeSmallInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBigInt.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBinary.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeFloat.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBool.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpRetry.py -B
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeTinyInt.py -B
#
# system test