test: enable telnet_tcp.py case
This commit is contained in:
parent
9533ad4198
commit
fd7d0f5928
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -17,5 +17,5 @@ python3 ./test.py -f 5-taos-tools/taosbenchmark/sample_csv_json.py
|
|||
python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_json_alltypes.py
|
||||
#python3 ./test.py -f 5-taos-tools/taosbenchmark/sml_telnet_alltypes.py
|
||||
#python3 ./test.py -f 5-taos-tools/taosbenchmark/taosadapter_json.py
|
||||
#python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py
|
||||
python3 ./test.py -f 5-taos-tools/taosbenchmark/telnet_tcp.py -R
|
||||
python3 ./test.py -f 5-taos-tools/taosbenchmark/taosdemoTestQueryWithJson.py -R
|
||||
|
|
|
@ -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}"
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue