未验证 提交 3bf58e6e 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #6417 from taosdata/test/TD-4553

[TD-4553]<test>fix timestamp error
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -72,14 +72,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
......@@ -98,14 +97,13 @@ class TDTestCase:
# TSIM: while $x < $rowNum
while (x < rowNum):
# TSIM: $ms = $x . m
ms = "%dm" % x
# TSIM: sql insert into $tb values (now + $ms , $x )
ms = x * 60000
tdLog.info(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
tdSql.execute(
'insert into %s values (now + %s , %d )' %
(tb, ms, x))
"insert into %s values (%d, %d)" %
(tb, 1605045600000 + ms, x))
# TSIM: $x = $x + 1
x = x + 1
# TSIM: endw
......@@ -124,56 +122,56 @@ class TDTestCase:
tdSql.checkRows(rowNum)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (tb))
tdSql.query('select * from %s where ts < now + 4m' % (tb))
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts <= now + 4m
tdLog.info('select * from %s where ts <= now + 4m' % (tb))
tdSql.query('select * from %s where ts <= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts <= 1605045600000 + 240001
tdLog.info('select * from %s where ts <= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts <= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (tb))
tdSql.query('select * from %s where ts > now + 4m' % (tb))
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts >= now + 4m
tdLog.info('select * from %s where ts >= now + 4m' % (tb))
tdSql.query('select * from %s where ts >= now + 4m' % (tb))
# TSIM: sql select * from $tb where ts >= 1605045600000 + 240001
tdLog.info('select * from %s where ts >= 1605045600000 + 240001' % (tb))
tdSql.query('select * from %s where ts >= 1605045600000 + 240001' % (tb))
# TSIM: if $rows != 15 then
tdLog.info('tdSql.checkRow(15)')
tdSql.checkRows(15)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts < now + 4m and ts > now + 5m
# TSIM: sql select * from $tb where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001
tdLog.info(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
tdSql.query(
'select * from %s where ts < now + 4m and ts > now + 5m' %
'select * from %s where ts < 1605045600000 + 240001 and ts > 1605045600000 + 300001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
......@@ -190,25 +188,25 @@ class TDTestCase:
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts < now + 3m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 3m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 180001' %
(tb))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $tb where ts > now + 4m and ts > now + 5m and
# ts < now + 6m
# TSIM: sql select * from $tb where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and
# ts < 1605045600000 + 360001
tdLog.info(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
tdSql.query(
'select * from %s where ts > now + 4m and ts > now + 5m and ts < now + 6m' %
'select * from %s where ts > 1605045600000 + 240001 and ts > 1605045600000 + 300001 and ts < 1605045600000 + 360001' %
(tb))
# TSIM: if $rows != 1 then
tdLog.info('tdSql.checkRow(1)')
......@@ -227,36 +225,36 @@ class TDTestCase:
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where ts < now + 4m
tdLog.info('select * from %s where ts < now + 4m' % (mt))
tdSql.query('select * from %s where ts < now + 4m' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001
tdLog.info('select * from %s where ts < 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts < 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 50 then
tdLog.info('tdSql.checkRow(50)')
tdSql.checkRows(50)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m
tdLog.info('select * from %s where ts > now + 4m' % (mt))
tdSql.query('select * from %s where ts > now + 4m' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001
tdLog.info('select * from %s where ts > 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts > 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 150 then
tdLog.info('tdSql.checkRow(150)')
tdSql.checkRows(150)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts = now + 4m
tdLog.info('select * from %s where ts = now + 4m' % (mt))
tdSql.query('select * from %s where ts = now + 4m' % (mt))
# TSIM: sql select * from $mt where ts = 1605045600000 + 240001
tdLog.info('select * from %s where ts = 1605045600000 + 240001' % (mt))
tdSql.query('select * from %s where ts = 1605045600000 + 240001' % (mt))
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 10 then
tdLog.info('tdSql.checkRow(10)')
......@@ -333,94 +331,94 @@ class TDTestCase:
# TSIM:
# TSIM: print =============== step5
tdLog.info('=============== step5')
# TSIM: sql select * from $mt where ts > now + 4m and tgcol = 1
tdLog.info('select * from %s where ts > now + 4m and tgcol = 1' % (mt))
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol = 1
tdLog.info('select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' % (mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol = 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol = 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 1
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 1
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 1' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 1' %
(mt))
# TSIM: if $rows != 75 then
tdLog.info('tdSql.checkRow(75)')
tdSql.checkRows(75)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol = 0
tdLog.info('select * from %s where ts < now + 4m and tgcol = 0' % (mt))
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol = 0
tdLog.info('select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' % (mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol = 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts < now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts < 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts < now + 4m and tgcol <> 0' %
'select * from %s where ts < 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol = 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol = 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol = 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol = 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts <= now + 4m and tgcol <> 0
# TSIM: sql select * from $mt where ts <= 1605045600000 + 240001 and tgcol <> 0
tdLog.info(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts <= now + 4m and tgcol <> 0' %
'select * from %s where ts <= 1605045600000 + 240001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 25 then
tdLog.info('tdSql.checkRow(25)')
tdSql.checkRows(25)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and ts < now + 5m and
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and
# tgcol <> 0
tdLog.info(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and ts < now + 5m and tgcol <> 0' %
'select * from %s where ts > 1605045600000 + 240001 and ts < 1605045600000 + 300001 and tgcol <> 0' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
tdSql.checkRows(5)
# TSIM: return -1
# TSIM: endi
# TSIM: sql select * from $mt where ts > now + 4m and tgcol <> 0 and ts
# < now + 5m
# TSIM: sql select * from $mt where ts > 1605045600000 + 240001 and tgcol <> 0 and ts
# < 1605045600000 + 300001
tdLog.info(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
tdSql.query(
'select * from %s where ts > now + 4m and tgcol <> 0 and ts < now + 5m' %
'select * from %s where ts > 1605045600000 + 240001 and tgcol <> 0 and ts < 1605045600000 + 300001' %
(mt))
# TSIM: if $rows != 5 then
tdLog.info('tdSql.checkRow(5)')
......@@ -467,12 +465,12 @@ class TDTestCase:
# TSIM: print =============== step8
tdLog.info('=============== step8')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
......@@ -522,13 +520,13 @@ class TDTestCase:
# TSIM: print =============== step11
tdLog.info('=============== step11')
# TSIM: sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol),
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m
# max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1605045600000 + 240001
# group by tgcol
tdLog.info(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
tdSql.query(
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < now + 4m group by tgcol' %
'select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from %s where ts < 1605045600000 + 240001 group by tgcol' %
(mt))
# TSIM: print $data00 $data01 $data02 $data03 $data04 $data05 $data06
tdLog.info('$data00 $data01 $data02 $data03 $data04 $data05 $data06')
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册