提交 fb2c5256 编写于 作者: P Ping Xiao

test: update perf test script

上级 496dfa8d
......@@ -32,7 +32,7 @@ class insertFromCSVPerformace:
self.host = "127.0.0.1"
self.user = "root"
self.password = "taosdata"
self.config = "/etc/perf"
self.config = "/etc/%s" % self.branchName
self.conn = taos.connect(
self.host,
self.user,
......@@ -95,6 +95,7 @@ class insertFromCSVPerformace:
in_order_time = (float) (totalTime / 10)
print("In order - Insert time: %f" % in_order_time)
cursor.execute("drop database if exists %s" % self.dbName)
cursor.close()
......@@ -133,9 +134,9 @@ if __name__ == '__main__':
'-b',
'--branch-name',
action='store',
default='develop',
default='2.4',
type=str,
help='branch name (default: develop)')
help='branch name (default: 2.4)')
parser.add_argument(
'-T',
'--build-type',
......
......@@ -32,7 +32,7 @@ class taosdemoQueryPerformace:
self.host = "127.0.0.1"
self.user = "root"
self.password = "taosdata"
self.config = "/etc/perf"
self.config = "/etc/%s" % self.branch
self.conn = taos.connect(
self.host,
self.user,
......@@ -55,35 +55,35 @@ class taosdemoQueryPerformace:
tableid = 1
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.meters"
sql = "select avg(current), max(voltage), min(phase) from test.meters"
tableid = 2
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select count(*) from test.meters where loc='beijing'"
sql = "select count(*) from test.meters where location='beijing'"
tableid = 3
cursor2.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.meters where areaid=10"
sql = "select avg(current), max(voltage), min(phase) from test.meters where groupid=10"
tableid = 4
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.t10 interval(10s)"
sql = "select avg(current), max(voltage), min(phase) from test.d10 interval(10s)"
tableid = 5
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select last_row(*) from meters"
sql = "select last_row(*) from test.meters"
tableid = 6
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select * from meters limit 10000"
sql = "select * from test.meters limit 10000"
tableid = 7
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'"
sql = "select avg(current), max(voltage), min(phase) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'"
tableid = 8
cursor2.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select last(*) from meters"
sql = "select last(*) from test.meters"
tableid = 9
cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
......@@ -106,7 +106,7 @@ class taosdemoQueryPerformace:
query_data = {
"filetype": "query",
"cfgdir": "/etc/perf",
"cfgdir": "/etc/%s" % self.branch,
"host": "127.0.0.1",
"port": 6030,
"user": "root",
......@@ -126,6 +126,7 @@ class taosdemoQueryPerformace:
return query_json_file
def getBuildPath(self):
buildPath=""
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
......@@ -134,7 +135,7 @@ class taosdemoQueryPerformace:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdemo" in files):
if ("perfMonitor" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
......@@ -150,7 +151,7 @@ class taosdemoQueryPerformace:
def query(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
print("taosdemo not found!")
print("perfMonitor not found!")
sys.exit(1)
binPath = buildPath + "/build/bin/"
......@@ -220,9 +221,9 @@ if __name__ == '__main__':
'-b',
'--git-branch',
action='store',
default='master',
default='2.4',
type=str,
help='git branch (default: master)')
help='git branch (default: 2.4)')
parser.add_argument(
'-T',
'--build-type',
......
......@@ -32,7 +32,7 @@ class taosdemoPerformace:
self.host = "127.0.0.1"
self.user = "root"
self.password = "taosdata"
self.config = "/etc/perf"
self.config = "/etc/%s" % self.branch
self.conn = taos.connect(
self.host,
self.user,
......@@ -88,7 +88,7 @@ class taosdemoPerformace:
insert_data = {
"filetype": "insert",
"cfgdir": "/etc/perf",
"cfgdir": "/etc/%s" % self.branch,
"host": "127.0.0.1",
"port": 6030,
"user": "root",
......@@ -112,6 +112,7 @@ class taosdemoPerformace:
return output
def getBuildPath(self):
buildPath = ""
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
......@@ -130,7 +131,7 @@ class taosdemoPerformace:
def insertData(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
print("taosdemo not found!")
print("perfMonitor not found!")
sys.exit(1)
binPath = buildPath + "/build/bin/"
......@@ -198,9 +199,9 @@ if __name__ == '__main__':
'-b',
'--git-branch',
action='store',
default='master',
default='2.4',
type=str,
help='git branch (default: master)')
help='git branch (default: 2.4)')
parser.add_argument(
'-T',
'--build-type',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册