From 63dc04d2de3f0895a10ea343d6c6cd9eb2a889c0 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 4 Feb 2025 10:26:20 +0800 Subject: [PATCH] feat: with new feature -B option to run taosadapter --- tests/army/test.py | 24 ++++---- .../benchmark/basic/json/rest_query.json | 2 +- .../benchmark/basic/json/rest_query1.json | 2 +- .../json/taosc_query-kill-slow-query.json | 19 ------ .../benchmark/basic/json/taosc_query.json | 2 +- .../benchmark/basic/json/taosc_query1.json | 2 +- .../basic/query_json-kill-slow-query.py | 60 ------------------- .../taosdump/native/taosdumpDbWithNonRoot.py | 4 +- .../tools/taosdump/ws/taosdumpTestTypeJson.py | 7 ++- tests/parallel_test/cases.task | 39 ++++++------ 10 files changed, 43 insertions(+), 118 deletions(-) delete mode 100644 tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json delete mode 100644 tests/army/tools/benchmark/basic/query_json-kill-slow-query.py diff --git a/tests/army/test.py b/tests/army/test.py index 332d7f29c4..d37d08b406 100644 --- a/tests/army/test.py +++ b/tests/army/test.py @@ -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() diff --git a/tests/army/tools/benchmark/basic/json/rest_query.json b/tests/army/tools/benchmark/basic/json/rest_query.json index 817d733202..f89cabf0ba 100644 --- a/tests/army/tools/benchmark/basic/json/rest_query.json +++ b/tests/army/tools/benchmark/basic/json/rest_query.json @@ -12,7 +12,7 @@ "sqls": [{ "sql": "select count(*) from db.stb", - "result": "rest_query_specified" + "result": "./rest_query_specified" }] } } \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/rest_query1.json b/tests/army/tools/benchmark/basic/json/rest_query1.json index e09112737e..46bdf6d9ff 100644 --- a/tests/army/tools/benchmark/basic/json/rest_query1.json +++ b/tests/army/tools/benchmark/basic/json/rest_query1.json @@ -11,7 +11,7 @@ "sqls": [ { "sql": "select count(*) from xxxx", - "result": "rest_query_super" + "result": "./rest_query_super" } ] } diff --git a/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json b/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json deleted file mode 100644 index 0fd9b15277..0000000000 --- a/tests/army/tools/benchmark/basic/json/taosc_query-kill-slow-query.json +++ /dev/null @@ -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" - } -} diff --git a/tests/army/tools/benchmark/basic/json/taosc_query.json b/tests/army/tools/benchmark/basic/json/taosc_query.json index 2cf8f648a6..5a0a083f48 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_query.json +++ b/tests/army/tools/benchmark/basic/json/taosc_query.json @@ -16,7 +16,7 @@ "sqls": [{ "sql": "select count(*) from db.stb", - "result": "taosc_query_specified" + "result": "./taosc_query_specified" }] } } \ No newline at end of file diff --git a/tests/army/tools/benchmark/basic/json/taosc_query1.json b/tests/army/tools/benchmark/basic/json/taosc_query1.json index fd650f90e5..a13ce1602f 100644 --- a/tests/army/tools/benchmark/basic/json/taosc_query1.json +++ b/tests/army/tools/benchmark/basic/json/taosc_query1.json @@ -17,7 +17,7 @@ "sqls": [ { "sql": "select count(*) from xxxx", - "result": "taosc_query_super" + "result": "./taosc_query_super" } ] } diff --git a/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py b/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py deleted file mode 100644 index 04dfba5463..0000000000 --- a/tests/army/tools/benchmark/basic/query_json-kill-slow-query.py +++ /dev/null @@ -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()) diff --git a/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py index 0997d0ea49..bc506852ee 100644 --- a/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py +++ b/tests/army/tools/taosdump/native/taosdumpDbWithNonRoot.py @@ -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) diff --git a/tests/army/tools/taosdump/ws/taosdumpTestTypeJson.py b/tests/army/tools/taosdump/ws/taosdumpTestTypeJson.py index d9b5584139..fcbf428ac4 100644 --- a/tests/army/tools/taosdump/ws/taosdumpTestTypeJson.py +++ b/tests/army/tools/taosdump/ws/taosdumpTestTypeJson.py @@ -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 diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0ce9a7aff0..a87d0385e4 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -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