提交 727ee9cc 编写于 作者: R root 提交者: Ping Xiao

udpate test cases

上级 7354ae1a
...@@ -96,13 +96,15 @@ class TDTestCase: ...@@ -96,13 +96,15 @@ class TDTestCase:
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id group by stb_t.id") "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.id group by stb_t.id")
tdSql.error( tdSql.error(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.name;") "select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.name;")
tdSql.error(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.location = stb_t.name")
tdSql.execute("alter table stb_t add tag pid int") tdSql.execute("alter table stb_t add tag pid int")
tdSql.execute("alter table tb_t1 set tag pid=2") tdSql.execute("alter table tb_t1 set tag pid=2")
tdSql.execute("alter table tb_t2 set tag pid=1") tdSql.execute("alter table tb_t2 set tag pid=1")
tdSql.query(
"select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.location = stb_t.name")
tdSql.checkRows(0)
tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.pid") tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_t.id, stb_p.dscrption, stb_p.pressure from stb_p, stb_t where stb_p.ts=stb_t.ts and stb_p.id = stb_t.pid")
tdSql.checkRows(3) tdSql.checkRows(3)
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
import os import os
import taos import taos
...@@ -36,6 +37,9 @@ class taosdemoQueryPerformace: ...@@ -36,6 +37,9 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select count(*) from test.meters") cursor.execute("select count(*) from test.meters")
totalTime += time.time() - startTime totalTime += time.time() - startTime
...@@ -43,6 +47,9 @@ class taosdemoQueryPerformace: ...@@ -43,6 +47,9 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select avg(f1), max(f2), min(f3) from test.meters") cursor.execute("select avg(f1), max(f2), min(f3) from test.meters")
totalTime += time.time() - startTime totalTime += time.time() - startTime
...@@ -50,6 +57,9 @@ class taosdemoQueryPerformace: ...@@ -50,6 +57,9 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select count(*) from test.meters where loc='beijing'") cursor.execute("select count(*) from test.meters where loc='beijing'")
totalTime += time.time() - startTime totalTime += time.time() - startTime
...@@ -57,6 +67,9 @@ class taosdemoQueryPerformace: ...@@ -57,6 +67,9 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select avg(f1), max(f2), min(f3) from test.meters where areaid=10") cursor.execute("select avg(f1), max(f2), min(f3) from test.meters where areaid=10")
totalTime += time.time() - startTime totalTime += time.time() - startTime
...@@ -64,6 +77,9 @@ class taosdemoQueryPerformace: ...@@ -64,6 +77,9 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select avg(f1), max(f2), min(f3) from test.t10 interval(10s)") cursor.execute("select avg(f1), max(f2), min(f3) from test.t10 interval(10s)")
totalTime += time.time() - startTime totalTime += time.time() - startTime
...@@ -71,11 +87,34 @@ class taosdemoQueryPerformace: ...@@ -71,11 +87,34 @@ class taosdemoQueryPerformace:
totalTime = 0 totalTime = 0
for i in range(100): for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time() startTime = time.time()
cursor.execute("select last_row(*) from meters") cursor.execute("select last_row(*) from meters")
totalTime += time.time() - startTime totalTime += time.time() - startTime
print("query time for: select last_row(*) from meters %f seconds" % (totalTime / 100)) print("query time for: select last_row(*) from meters %f seconds" % (totalTime / 100))
totalTime = 0
for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time()
cursor.execute("select * from meters")
totalTime += time.time() - startTime
print("query time for: select * from meters %f seconds" % (totalTime / 100))
totalTime = 0
for i in range(100):
if(sys.argv[1] == '1'):
# root permission is required
os.system("echo 3 > /proc/sys/vm/drop_caches")
startTime = time.time()
cursor.execute("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'")
totalTime += time.time() - startTime
print("query time for: 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' %f seconds" % (totalTime / 100))
if __name__ == '__main__': if __name__ == '__main__':
perftest = taosdemoQueryPerformace() perftest = taosdemoQueryPerformace()
perftest.initConnection() perftest.initConnection()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册