未验证 提交 84c1bac5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #4296 from taosdata/xiaoping/add_test_case2

[TD-1355] <test> add test case, fix queryInterval
......@@ -32,30 +32,44 @@ class TDTestCase:
tdSql.execute("insert into t0 using st tags('beijing') values(%d, 220) (%d, 221) (%d, 225) (%d, 228) (%d, 222)"
% (self.ts, self.ts + 1000000000, self.ts + 2000000000, self.ts + 3000000000, self.ts + 6000000000))
tdSql.execute("insert into t1 using st tags('shanghai') values(%d, 220) (%d, 221) (%d, 225) (%d, 228) (%d, 222)"
% (self.ts, self.ts + 2000000000, self.ts + 4000000000, self.ts + 5000000000, self.ts + 7000000000))
% (self.ts, self.ts + 2000000000, self.ts + 4000000000, self.ts + 5000000000, self.ts + 7000000000))
tdSql.query("select avg(voltage) from st interval(1n)")
tdSql.checkRows(4)
tdSql.checkData(0, 1, 220.0)
tdSql.checkData(1, 1, 222.33333333333334)
tdSql.checkData(2, 1, 227.0)
tdSql.checkData(3, 1, 222.0)
tdSql.checkRows(3)
tdSql.checkData(0, 0, "2020-07-01 00:00:00")
tdSql.checkData(0, 1, 221.4)
tdSql.checkData(1, 0, "2020-08-01 00:00:00")
tdSql.checkData(1, 1, 227.0)
tdSql.checkData(2, 0, "2020-09-01 00:00:00")
tdSql.checkData(2, 1, 222.0)
tdSql.query("select avg(voltage) from st interval(1n, 15d)")
tdSql.checkRows(4)
tdSql.checkData(0, 0, "2020-06-16 00:00:00")
tdSql.checkData(0, 1, 220.333333)
tdSql.checkData(1, 0, "2020-07-16 00:00:00")
tdSql.checkData(1, 1, 224.666666)
tdSql.checkData(2, 0, "2020-08-16 00:00:00")
tdSql.checkData(2, 1, 225.0)
tdSql.checkData(3, 0, "2020-09-16 00:00:00")
tdSql.checkData(3, 1, 222.0)
tdSql.query("select avg(voltage) from st interval(1n, 15d) group by loc")
tdSql.checkRows(7)
tdSql.checkData(0, 0, "2020-06-16 00:00:00")
tdSql.checkData(0, 1, 220.5)
tdSql.checkData(1, 0, "2020-07-16 00:00:00")
tdSql.checkData(1, 1, 226.5)
tdSql.checkData(2, 0, "2020-08-16 00:00:00")
tdSql.checkData(2, 1, 222.0)
tdSql.checkData(3, 0, "2020-06-16 00:00:00")
tdSql.checkData(3, 1, 220.0)
tdSql.checkData(4, 0, "2020-07-16 00:00:00")
tdSql.checkData(4, 1, 221.0)
tdSql.checkData(5, 0, "2020-08-16 00:00:00")
tdSql.checkData(5, 1, 226.5)
tdSql.checkData(6, 0, "2020-09-16 00:00:00")
tdSql.checkData(6, 1, 222.0)
def stop(self):
......
......@@ -55,6 +55,12 @@ class TDTestCase:
tdSql.query("select count(*) from meters")
tdSql.checkData(0, 0, self.numberOfTables * self.numberOfRecords)
tdSql.query("select sum(f1) from test.meters interval(1h) sliding(30m)")
tdSql.checkRows(2)
tdSql.query("select apercentile(f1, 1) from test.meters interval(10s)")
tdSql.checkRows(11)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册