diff --git a/tests/pytest/insert/insertFromCSVPerformance.py b/tests/pytest/perfbenchmark/insertFromCSVPerformance.py similarity index 96% rename from tests/pytest/insert/insertFromCSVPerformance.py rename to tests/pytest/perfbenchmark/insertFromCSVPerformance.py index 487497631a368778c857ce71234a4574837390c1..27de19f67f5d348181544961ef3329f95e740909 100644 --- a/tests/pytest/insert/insertFromCSVPerformance.py +++ b/tests/pytest/perfbenchmark/insertFromCSVPerformance.py @@ -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', diff --git a/tests/pytest/query/queryPerformance.py b/tests/pytest/perfbenchmark/queryPerformance.py similarity index 89% rename from tests/pytest/query/queryPerformance.py rename to tests/pytest/perfbenchmark/queryPerformance.py index 29e5cb19b75b0943c24382d268e81daebed01cdf..cd64f8e2a264c69dfb9e84b11779d886a676834d 100644 --- a/tests/pytest/query/queryPerformance.py +++ b/tests/pytest/perfbenchmark/queryPerformance.py @@ -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', diff --git a/tests/pytest/tools/taosdemoPerformance.py b/tests/pytest/perfbenchmark/taosdemoPerformance.py similarity index 97% rename from tests/pytest/tools/taosdemoPerformance.py rename to tests/pytest/perfbenchmark/taosdemoPerformance.py index 82c57a656dfea12f80fe4eb2b530742c5bfb0916..1d91d056abf870830d3a2117bc6df81c57140590 100644 --- a/tests/pytest/tools/taosdemoPerformance.py +++ b/tests/pytest/perfbenchmark/taosdemoPerformance.py @@ -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',