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

test: update perf test script

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