[add cases]
This commit is contained in:
parent
6c4b004f98
commit
78bf3913e7
|
@ -0,0 +1,292 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sleep 50
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== create database
|
||||||
|
sql create database d0
|
||||||
|
sql show databases
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data00 $data01 $data02
|
||||||
|
|
||||||
|
sql use d0
|
||||||
|
|
||||||
|
|
||||||
|
sql create table vehicle (ts timestamp, s int) tags (t1 int)
|
||||||
|
sql show stables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql create table car using vehicle tags(1000)
|
||||||
|
#sql create table ct1 using vehicle tags (1000)
|
||||||
|
sql show tables;
|
||||||
|
if $rows != 1 then
|
||||||
|
print rows: $rows
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql insert into ct1 values('2019-01-01 00:00:00', 1)
|
||||||
|
sql insert into car values('2019-05-13 12:00:00', 1)
|
||||||
|
sql insert into car values('2019-12-31 23:59:59', 1)
|
||||||
|
sql insert into car values('2020-01-01 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-01-02 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-01-03 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-01-04 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-01-05 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-01-31 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-02-01 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-02-02 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-02-29 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-03-01 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-03-02 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-03-15 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-03-31 12:00:00', 1)
|
||||||
|
sql insert into car values('2020-05-01 12:00:00', 1)
|
||||||
|
|
||||||
|
sql select count(*) from car interval(1n, 10d)
|
||||||
|
# tdSql.checkData(0, 1, 1)
|
||||||
|
# tdSql.checkData(1, 1, 1)
|
||||||
|
# tdSql.checkData(2, 1, 6)
|
||||||
|
# tdSql.checkData(3, 1, 3)
|
||||||
|
# tdSql.checkData(4, 1, 3)
|
||||||
|
# tdSql.checkData(5, 1, 2)
|
||||||
|
# tdSql.checkData(6, 1, 1)
|
||||||
|
if $rows != 17 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data10 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data20 != 6 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data30 != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data40 != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data50 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data60 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
sql select count(*) from car interval(1n, 10d) order by ts desc
|
||||||
|
# tdSql.checkData(0, 1, 1)
|
||||||
|
# tdSql.checkData(1, 1, 2)
|
||||||
|
# tdSql.checkData(2, 1, 3)
|
||||||
|
# tdSql.checkData(3, 1, 3)
|
||||||
|
# tdSql.checkData(4, 1, 6)
|
||||||
|
# tdSql.checkData(5, 1, 1)
|
||||||
|
# tdSql.checkData(6, 1, 1)
|
||||||
|
#
|
||||||
|
sql select count(*) from car interval(2n, 5d)
|
||||||
|
# tdSql.checkData(0, 1, 1)
|
||||||
|
# tdSql.checkData(1, 1, 1)
|
||||||
|
# tdSql.checkData(2, 1, 6)
|
||||||
|
# tdSql.checkData(3, 1, 6)
|
||||||
|
# tdSql.checkData(4, 1, 3)
|
||||||
|
|
||||||
|
sql select count(*) from car interval(2n) order by ts desc
|
||||||
|
# tdSql.checkData(0, 1, 3)
|
||||||
|
# tdSql.checkData(1, 1, 6)
|
||||||
|
# tdSql.checkData(2, 1, 6)
|
||||||
|
# tdSql.checkData(3, 1, 1)
|
||||||
|
# tdSql.checkData(4, 1, 1)
|
||||||
|
#
|
||||||
|
sql select count(*) from car interval(1y, 1n)
|
||||||
|
# tdSql.checkData(0, 1, 1)
|
||||||
|
# tdSql.checkData(1, 1, 8)
|
||||||
|
# tdSql.checkData(2, 1, 8)
|
||||||
|
#
|
||||||
|
sql select count(*) from car interval(1y, 2n)
|
||||||
|
# tdSql.checkData(0, 1, 1)
|
||||||
|
# tdSql.checkData(1, 1, 11)
|
||||||
|
# tdSql.checkData(2, 1, 5)
|
||||||
|
|
||||||
|
sql select count(*) from car where ts > '2019-05-14 00:00:00' interval(1y, 5d)
|
||||||
|
# tdSql.checkData(0, 1, 6)
|
||||||
|
# tdSql.checkData(1, 1, 9)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
|
||||||
|
|
||||||
|
print ====== start create child tables and insert data
|
||||||
|
$i = 0
|
||||||
|
while $i < $tbNum
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
sql create table $tb using $mt tags( $i )
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
while $x < $rowNum
|
||||||
|
$cc = $x * 60000
|
||||||
|
$ms = 1601481600000 + $cc
|
||||||
|
|
||||||
|
sql insert into $tb values ($ms , $x )
|
||||||
|
$x = $x + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
$i = $i + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
print =============== step2
|
||||||
|
$i = 1
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
|
||||||
|
sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m)
|
||||||
|
print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb interval(1m)
|
||||||
|
print ===> $rows $data01 $data05
|
||||||
|
if $rows != $rowNum then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data04 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
#print =============== step3
|
||||||
|
#$cc = 4 * 60000
|
||||||
|
#$ms = 1601481600000 + $cc
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m)
|
||||||
|
#print ===> $rows $data01 $data05
|
||||||
|
#if $rows != 5 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data00 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data04 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#print =============== step4
|
||||||
|
#$cc = 40 * 60000
|
||||||
|
#$ms = 1601481600000 + $cc
|
||||||
|
|
||||||
|
#$cc = 1 * 60000
|
||||||
|
#$ms2 = 1601481600000 - $cc
|
||||||
|
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m)
|
||||||
|
#print ===> $rows $data01 $data05
|
||||||
|
#if $rows != 20 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data00 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data04 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#print =============== step5
|
||||||
|
#$cc = 40 * 60000
|
||||||
|
#$ms = 1601481600000 + $cc
|
||||||
|
|
||||||
|
#$cc = 1 * 60000
|
||||||
|
#$ms2 = 1601481600000 - $cc
|
||||||
|
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
|
||||||
|
#print ===> $rows $data21 $data25
|
||||||
|
#if $rows != 42 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data20 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data24 != 1 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#print =============== step6
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt interval(1m)
|
||||||
|
#print ===> $rows $data11
|
||||||
|
#if $rows != 20 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data11 != 10 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#print =============== step7
|
||||||
|
#$cc = 4 * 60000
|
||||||
|
#$ms = 1601481600000 + $cc
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m)
|
||||||
|
#print ===> $rows $data11
|
||||||
|
#if $rows != 5 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data11 != 10 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#print =============== step8
|
||||||
|
#$cc = 40 * 60000
|
||||||
|
#$ms1 = 1601481600000 + $cc
|
||||||
|
#
|
||||||
|
#$cc = 1 * 60000
|
||||||
|
#$ms2 = 1601481600000 - $cc
|
||||||
|
#
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m)
|
||||||
|
#print ===> $rows $data11
|
||||||
|
#if $rows != 20 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data11 != 10 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#
|
||||||
|
#print =============== step9
|
||||||
|
#$cc = 40 * 60000
|
||||||
|
#$ms1 = 1601481600000 + $cc
|
||||||
|
#
|
||||||
|
#$cc = 1 * 60000
|
||||||
|
#$ms2 = 1601481600000 - $cc
|
||||||
|
#
|
||||||
|
#sql select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0)
|
||||||
|
#print ===> select count(tbcol), sum(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0)
|
||||||
|
#print ===> $rows $data11
|
||||||
|
#if $rows != 42 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
#if $data11 != 10 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
print =============== clear
|
||||||
|
#sql drop database $db
|
||||||
|
#sql show databases
|
||||||
|
#if $rows != 0 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue