diff --git a/tests/script/tsim/valgrind/basic3.sim b/tests/script/tsim/valgrind/basic3.sim index 7fba66c468f13a46397208cff592afdb7f047c6d..6a42a8eb7fd2b6b5507b0c5b892d7b5e85dfa58f 100644 --- a/tests/script/tsim/valgrind/basic3.sim +++ b/tests/script/tsim/valgrind/basic3.sim @@ -1,13 +1,10 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/deploy.sh -n dnode2 -i 2 +system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v -system sh/exec.sh -n dnode2 -s start -v sql connect -print =============== add dnode2 into cluster -sql create dnode $hostname port 7200 - +print =============== step1: create drop show dnodes $x = 0 step1: $x = $x + 1 @@ -18,135 +15,59 @@ step1: endi sql show dnodes print ---> $data00 $data01 $data02 $data03 $data04 $data05 -print ---> $data10 $data11 $data12 $data13 $data14 $data15 -if $rows != 2 then +if $rows != 1 then return -1 endi if $data(1)[4] != ready then goto step1 endi -if $data(2)[4] != ready then - goto step1 -endi - -print =============== create database, stable, table -sql create database db vgroups 3 -sql use db -sql create table stb (ts timestamp, c int) tags (t int) -sql create table t0 using stb tags (0) -sql create table tba (ts timestamp, c1 binary(10), c2 nchar(10)); - -print =============== run show xxxx -sql show dnodes -if $rows != 2 then - return -1 -endi - -sql show mnodes -if $rows != 1 then - return -1 -endi +print =============== step2: create db +sql create database d1 vgroups 2 buffer 3 sql show databases -if $rows != 3 then - return -1 -endi +sql use d1 +sql show vgroups +print =============== step3: create show stable +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) sql show stables if $rows != 1 then return -1 endi +print =============== step4: create show table +sql create table ct1 using stb tags(1000) +sql create table ct2 using stb tags(2000) +sql create table ct3 using stb tags(3000) sql show tables -if $rows != 2 then - return -1 -endi - -sql show users -if $rows != 1 then - return -1 -endi - -sql show vgroups -if $rows != 3 then - return -1 -endi - -print =============== run select * from information_schema.xxxx -sql select * from information_schema.`dnodes` -if $rows != 2 then - return -1 -endi - -sql select * from information_schema.`mnodes` -if $rows != 1 then - return -1 -endi - -sql select * from information_schema.user_databases -if $rows != 3 then - return -1 -endi - -sql select * from information_schema.user_stables -if $rows != 1 then - return -1 -endi - -sql select * from information_schema.user_tables -if $rows != 31 then - return -1 -endi - -sql select * from information_schema.user_users -if $rows != 1 then - return -1 -endi - -sql select * from information_schema.`vgroups` if $rows != 3 then return -1 endi -sql show variables; -if $rows != 4 then - return -1 -endi +print =============== step5: insert data +sql insert into ct1 values(now+0d, 10, 2.0, 3.0) +sql insert into ct1 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3) +sql insert into ct2 values(now+0d, 10, 2.0, 3.0) +sql insert into ct2 values(now+1d, 11, 2.1, 3.1)(now+2d, -12, -2.2, -3.2)(now+3d, -13, -2.3, -3.3) +sql insert into ct3 values('2022-01-01 00:00:00.000', 10, 2.0, 3.0) -sql show dnode 1 variables; -if $rows <= 0 then - return -1 -endi - -sql show local variables; -if $rows <= 0 then - return -1 -endi +print =============== step6: query data +sql select * from ct1 where ts < now -1d and ts > now +1d +sql select * from stb where ts < now -1d and ts > now +1d +sql select * from ct1 where ts < now -1d and ts > now +1d order by ts desc +sql select * from stb where ts < now -1d and ts > now +1d order by ts desc -print ==== stop dnode1 and dnode2, and restart dnodes +_OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT - -print =============== check dnode1 -system_content sh/checkValgrind.sh -n dnode1 -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - +print =============== check $null= -if $system_content == $null then - return 0 -endi -print =============== check dnode2 -system_content sh/checkValgrind.sh -n dnode2 +system_content sh/checkValgrind.sh -n dnode1 print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 +if $system_content > 1 then + return -1 endi -$null= if $system_content == $null then - return 0 + return -1 endi diff --git a/tests/script/tsim/valgrind/checkError2.sim b/tests/script/tsim/valgrind/checkError2.sim index 3a82218015b833e0c4a5c9c15c9ab3323c58ea42..9746fe9ecf44bbd4a8b23c7e6c2822c3222a3612 100644 --- a/tests/script/tsim/valgrind/checkError2.sim +++ b/tests/script/tsim/valgrind/checkError2.sim @@ -23,7 +23,7 @@ if $data(1)[4] != ready then endi print =============== step2: create db -sql create database d1 vgroups 1 buffer 3 +sql create database d1 vgroups 2 buffer 3 sql show databases sql use d1 sql show vgroups @@ -44,24 +44,32 @@ if $rows != 3 then return -1 endi -print =============== step5: insert data +print =============== step5: insert data (null / update) sql insert into ct1 values(now+0s, 10, 2.0, 3.0) -sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct1 values(now+1s, 11, 2.1, NULL)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) sql insert into ct2 values(now+0s, 10, 2.0, 3.0) sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) -sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) +sql insert into ct3 values('2021-01-01 00:00:00.000', NULL, NULL, 3.0) +sql insert into ct3 values('2022-03-02 16:59:00.010', 3 , 4, 5), ('2022-03-02 16:59:00.010', 33 , 4, 5), ('2022-04-01 16:59:00.011', 4, 4, 5), ('2022-04-01 16:59:00.011', 6, 4, 5), ('2022-03-06 16:59:00.013', 8, 4, 5); +sql insert into ct3 values('2022-03-02 16:59:00.010', 103, 1, 2), ('2022-03-02 16:59:00.010', 303, 3, 4), ('2022-04-01 16:59:00.011', 40, 5, 6), ('2022-04-01 16:59:00.011', 60, 4, 5), ('2022-03-06 16:59:00.013', 80, 4, 5); print =============== step6: query data sql select * from ct1 sql select * from stb sql select c1, c2, c3 from ct1 sql select ts, c1, c2, c3 from stb +sql select * from ct1 where ts < now -1d and ts > now +1d +sql select * from stb where ts < now -1d and ts > now +1d +#sql select * from ct1 where ts < now -1d and ts > now +1d order by ts desc +#sql select * from stb where ts < now -1d and ts > now +1d order by ts desc print =============== step7: count sql select count(*) from ct1; sql select count(*) from stb; sql select count(ts), count(c1), count(c2), count(c3) from ct1 sql select count(ts), count(c1), count(c2), count(c3) from stb +sql select count(*) from ct1 where ts < now -1d and ts > now +1d +sql select count(*) from stb where ts < now -1d and ts > now +1d print =============== step8: func sql select first(ts), first(c1), first(c2), first(c3) from ct1 @@ -69,6 +77,20 @@ sql select min(c1), min(c2), min(c3) from ct1 sql select max(c1), max(c2), max(c3) from ct1 sql select sum(c1), sum(c2), sum(c3) from ct1 +print =============== step9: insert select +#sql create table ct4 using stb tags(4000); +#sql insert into ct4 select * from ct1; +#sql select * from ct4; +#sql insert into ct4 select ts,c1,c2,c3 from stb; + +#sql create table tb1 (ts timestamp, c1 int, c2 float, c3 double); +#sql insert into tb1 (ts, c1, c2, c3) select * from ct1; +#sql select * from tb1; + +#sql create table tb2 (ts timestamp, f1 binary(10), c1 int, c2 double); +#sql insert into tb2 (c2, c1, ts) select c2+1, c1, ts+3 from ct2; +#sql select * from tb2; + _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT print =============== check