diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json index 29cd6770381dd40683763f9f485b7345d6da6070..9e1241397fe13eced0000c600ad76971a30227ca 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json @@ -17,13 +17,7 @@ "databases": [{ "dbinfo": { "name": "db", - "drop": "yes", - "replica": 1, - "precision": "ms", - "keep": 36500, - "minRows": 100, - "maxRows": 4096, - "comp":2 + "drop": "yes" }, "super_tables": [{ "name": "stb1", diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py b/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py index 78cb49846e9b6908ce8400508aa8da2c64fdff8b..23e788916f63d899d3ae3059a8062d54dcf329c6 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/telnet_tcp.py @@ -16,36 +16,40 @@ from util.log import * from util.cases import * from util.sql import * from util.dnodes import * -from util.taosadapter import * + class TDTestCase: def caseDescription(self): - ''' + """ [TD-11510] taosBenchmark test cases - ''' - return + """ def init(self, conn, logSql, replicaVar=1): - self.replicaVar = int(replicaVar) tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor(), logSql) def getPath(self, tool="taosBenchmark"): selfPath = os.path.dirname(os.path.realpath(__file__)) - if ("community" in selfPath): - projPath = selfPath[:selfPath.find("community")] + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + elif "src" in selfPath: + projPath = selfPath[: selfPath.find("src")] + elif "/tools/" in selfPath: + projPath = selfPath[: selfPath.find("/tools/")] + elif "/tests/" in selfPath: + projPath = selfPath[: selfPath.find("/tests/")] else: - projPath = selfPath[:selfPath.find("tests")] + tdLog.exit("cannot found %s in path: %s, use system's" % (tool, selfPath)) paths = [] for root, dirs, files in os.walk(projPath): - if ((tool) in files): + if (tool) in files: rootRealPath = os.path.dirname(os.path.realpath(root)) - if ("packaging" not in rootRealPath): + if "packaging" not in rootRealPath: paths.append(os.path.join(root, tool)) break - if (len(paths) == 0): + if len(paths) == 0: tdLog.exit("taosBenchmark not found!") return else: @@ -53,38 +57,30 @@ class TDTestCase: return paths[0] def run(self): - tAdapter.init("") - adapter_cfg = { - "influxdb": { - "enable": True - }, - "opentsdb": { - "enable": True - }, - "opentsdb_telnet": { - "enable": True, - "maxTCPConnection": 250, - "tcpKeepAlive": True, - "dbs": ["opentsdb_telnet", "collectd", "icinga2", "tcollector"], - "ports": [6046, 6047, 6048, 6049], - "user": "root", - "password": "taosdata" - } - } - tAdapter.update_cfg(adapter_cfg) - tAdapter.deploy() - tAdapter.start() binPath = self.getPath() - cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json" %binPath + cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_telnet_tcp.json" % binPath tdLog.info("%s" % cmd) os.system("%s" % cmd) time.sleep(5) tdSql.execute("reset query cache") - tdSql.query("select count(*) from (select distinct(tbname) from opentsdb_telnet.stb1)") + tdSql.query("select client_version()") + client_ver = "".join(tdSql.queryResult[0]) + major_ver = client_ver.split(".")[0] + if major_ver == "3": + tdSql.query( + "select count(*) from (select distinct(tbname) from opentsdb_telnet.stb1)" + ) + else: + tdSql.query("select count(tbname) from opentsdb_telnet.stb1") tdSql.checkData(0, 0, 8) tdSql.query("select count(*) from opentsdb_telnet.stb1") tdSql.checkData(0, 0, 160) - tdSql.query("select count(*) from (select distinct(tbname) from opentsdb_telnet.stb2)") + if major_ver == "3": + tdSql.query( + "select count(*) from (select distinct(tbname) from opentsdb_telnet.stb2)" + ) + else: + tdSql.query("select count(tbname) from opentsdb_telnet.stb2") tdSql.checkData(0, 0, 8) tdSql.query("select count(*) from opentsdb_telnet.stb2") tdSql.checkData(0, 0, 160) diff --git a/tests/develop-test/test.py b/tests/develop-test/test.py index 062e48b94b013d370f8be1dd785fdee35c74aef0..1b0f0d0aed7c7a6410691f0b8c894c7823625832 100644 --- a/tests/develop-test/test.py +++ b/tests/develop-test/test.py @@ -238,7 +238,7 @@ if __name__ == "__main__": time.sleep(2) if restful: - toBeKilled = "taosadapt" + toBeKilled = "taosadapter" # killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled killCmd = f"pkill {toBeKilled}" diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index a541b5ddbcd883570960115b4c38cefe58ba05fc..aa98260b0a78e581a1331d2fc12e7915ea11a725 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -1006,6 +1006,7 @@ ,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py ,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py ,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R +,,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R #docs-examples test ,,,docs-examples-test,bash python.sh diff --git a/tests/pytest/util/taosadapter.py b/tests/pytest/util/taosadapter.py index 0307675dfbe39d7f573ee65cb8b97e0d24f9c34b..440c23dc65155513208d69a7282822817d38ace9 100644 --- a/tests/pytest/util/taosadapter.py +++ b/tests/pytest/util/taosadapter.py @@ -13,7 +13,7 @@ class TAdapter: "debug" : True, "taosConfigDir" : "", "port" : 6041, - "logLevel" : "debug", + "logLevel" : "error", "cors" : { "allowAllOrigins" : True, }, @@ -49,25 +49,25 @@ class TAdapter: "writeInterval" : "30s" }, "opentsdb" : { - "enable" : False + "enable" : True }, "influxdb" : { - "enable" : False + "enable" : True }, "statsd" : { - "enable" : False + "enable" : True }, "collectd" : { - "enable" : False + "enable" : True }, "opentsdb_telnet" : { - "enable" : False + "enable" : True }, "node_exporter" : { - "enable" : False + "enable" : True }, "prometheus" : { - "enable" : False + "enable" : True }, } # TODO: add taosadapter env: @@ -164,7 +164,7 @@ class TAdapter: if platform.system().lower() == 'windows': cmd = f"mintty -h never {bin_path} -c {self.cfg_dir}" else: - cmd = f"nohup {bin_path} -c {self.cfg_path} > /dev/null 2>&1 & " + cmd = f"nohup {bin_path} -c {self.cfg_path} > /dev/null & " if self.remoteIP: self.remote_exec(self.taosadapter_cfg_dict, f"tAdapter.deployed=1\ntAdapter.log_dir={self.log_dir}\ntAdapter.cfg_dir={self.cfg_dir}\ntAdapter.start()") @@ -213,7 +213,7 @@ class TAdapter: if platform.system().lower() == 'windows': cmd = f"mintty -h never {bin_path} -c {self.cfg_dir}" else: - cmd = f"nohup {bin_path} -c {self.cfg_path} > /dev/null 2>&1 & " + cmd = f"nohup {bin_path} -c {self.cfg_path} > /dev/null & " if self.remoteIP: self.remote_exec(self.taosadapter_cfg_dict, f"tAdapter.deployed=1\ntAdapter.log_dir={self.log_dir}\ntAdapter.cfg_dir={self.cfg_dir}\ntAdapter.start()") @@ -243,7 +243,7 @@ class TAdapter: psCmd, shell=True) while(processID): - killCmd = f"pkill {signal} {processID} > /dev/null 2>&1" + killCmd = f"pkill {signal} {processID} > /dev/null " os.system(killCmd) time.sleep(1) processID = subprocess.check_output( @@ -256,9 +256,9 @@ class TAdapter: # fuserCmd = f"fuser -k -n tcp {port} > /dev/null" # os.system(fuserCmd) - self.running = 0 - tdLog.debug(f"taosadapter is stopped by kill {signal}") + self.running = 0 + tdLog.debug(f"taosadapter is stopped by kill {signal}") -tAdapter = TAdapter() \ No newline at end of file +tAdapter = TAdapter() diff --git a/tests/system-test/test.py b/tests/system-test/test.py index e171baa6563d82a9767236e10b1cc2abf98977d7..d942147c03abab04ed43d0d71e8f479e6982c167 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -215,7 +215,7 @@ if __name__ == "__main__": time.sleep(2) if restful: - toBeKilled = "taosadapt" + toBeKilled = "taosadapter" # killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled killCmd = f"pkill {toBeKilled}"