From 77e481c7ef0d11be0b9232d50ebbddfd9dd315ac Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 21 Jul 2022 11:52:03 +0800 Subject: [PATCH] test: restore 2.0 case --- tests/script/jenkins/basic.txt | 31 ++++---- tests/script/tsim/parser/commit.sim | 5 +- tests/script/tsim/parser/condition.sim | 13 +--- tests/script/tsim/parser/condition_query.sim | 39 +++++----- tests/script/tsim/parser/create_mt.sim | 36 ++++----- tests/script/tsim/parser/create_tb.sim | 10 ++- tests/script/tsim/parser/dbtbnameValidate.sim | 73 +++++++++---------- tests/script/tsim/parser/distinct.sim | 3 +- 8 files changed, 93 insertions(+), 117 deletions(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 6c1938d9fc..70e5bdcfa2 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -91,24 +91,23 @@ ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim ./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim -# nojira ./test.sh -f tsim/parser/col_arithmetic_operation.sim -# nojira ./test.sh -f tsim/parser/columnValue.sim -## ./test.sh -f tsim/parser/commit.sim -## ./test.sh -f tsim/parser/condition.sim +# jira ./test.sh -f tsim/parser/col_arithmetic_operation.sim +# jira ./test.sh -f tsim/parser/columnValue.sim +./test.sh -f tsim/parser/commit.sim +# jira ./test.sh -f tsim/parser/condition.sim ## ./test.sh -f tsim/parser/constCol.sim -# ./test.sh -f tsim/parser/create_db.sim -## ./test.sh -f tsim/parser/create_db__for_community_version.sim -# ./test.sh -f tsim/parser/create_mt.sim -# ./test.sh -f tsim/parser/create_tb.sim -## ./test.sh -f tsim/parser/create_tb_with_tag_name.sim -# ./test.sh -f tsim/parser/dbtbnameValidate.sim -##./test.sh -f tsim/parser/distinct.sim -# ./test.sh -f tsim/parser/fill.sim -# ./test.sh -f tsim/parser/fill_stb.sim -## ./test.sh -f tsim/parser/fill_us.sim -# ./test.sh -f tsim/parser/first_last.sim +./test.sh -f tsim/parser/create_db.sim +./test.sh -f tsim/parser/create_mt.sim +# jira ./test.sh -f tsim/parser/create_tb_with_tag_name.sim +./test.sh -f tsim/parser/create_tb.sim +./test.sh -f tsim/parser/dbtbnameValidate.sim +./test.sh -f tsim/parser/distinct.sim +# jira ./test.sh -f tsim/parser/fill_stb.sim +./test.sh -f tsim/parser/fill_us.sim +./test.sh -f tsim/parser/fill.sim +./test.sh -f tsim/parser/first_last.sim ./test.sh -f tsim/parser/fourArithmetic-basic.sim -## ./test.sh -f tsim/parser/function.sim +# jira ./test.sh -f tsim/parser/function.sim ./test.sh -f tsim/parser/groupby-basic.sim # ./test.sh -f tsim/parser/groupby.sim ## ./test.sh -f tsim/parser/having.sim diff --git a/tests/script/tsim/parser/commit.sim b/tests/script/tsim/parser/commit.sim index 83b457673b..0877168609 100644 --- a/tests/script/tsim/parser/commit.sim +++ b/tests/script/tsim/parser/commit.sim @@ -20,7 +20,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db maxrows 255 ctime 3600 +sql create database $db maxrows 255 print ====== create tables sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) @@ -78,12 +78,9 @@ endw print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 500 system sh/exec.sh -n dnode1 -s start -sleep 100 print ================== server restart completed sql connect -sleep 100 print ====== select from table and check num of rows returned sql use $db diff --git a/tests/script/tsim/parser/condition.sim b/tests/script/tsim/parser/condition.sim index 8c1327baae..700d1b98c0 100644 --- a/tests/script/tsim/parser/condition.sim +++ b/tests/script/tsim/parser/condition.sim @@ -2,11 +2,11 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start sql connect + sql drop database if exists cdb sql create database if not exists cdb sql use cdb sql create table stb1 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) - sql create table tb1 using stb1 tags(1,'1',1.0) sql create table tb2 using stb1 tags(2,'2',2.0) sql create table tb3 using stb1 tags(3,'3',3.0) @@ -45,7 +45,6 @@ sql insert into tb6 values ('2021-05-05 18:19:27',64,64.0,64,64,64,64.0,false,'6 sql insert into tb6 values ('2021-05-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) sql create table stb2 (ts timestamp, u1 int unsigned, u2 bigint unsigned, u3 smallint unsigned, u4 tinyint unsigned, ts2 timestamp) TAGS(t1 int unsigned, t2 bigint unsigned, t3 timestamp, t4 int) - sql create table tb2_1 using stb2 tags(1,1,'2021-05-05 18:38:38',1) sql create table tb2_2 using stb2 tags(2,2,'2021-05-05 18:58:58',2) @@ -67,7 +66,6 @@ sql insert into tb2_2 values ('2021-05-05 18:19:14',8,2,3,4,'2021-05-05 18:28:15 sql insert into tb2_2 values ('2021-05-05 18:19:15',5,6,7,8,'2021-05-05 18:28:16') sql create table stb3 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(10), t3 double) - sql create table tb3_1 using stb3 tags(1,'1',1.0) sql create table tb3_2 using stb3 tags(2,'2',2.0) @@ -78,7 +76,6 @@ sql insert into tb3_1 values ('2021-04-05 18:19:03',4,4.0,4,4,4,4.0,false,'4','4 sql insert into tb3_1 values ('2021-05-05 18:19:28',5,NULL,5,NULL,5,NULL,true,NULL,'5') sql insert into tb3_1 values ('2021-06-05 18:19:28',NULL,6.0,NULL,6,NULL,6.0,NULL,'6',NULL) sql insert into tb3_1 values ('2021-07-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) - sql insert into tb3_2 values ('2021-01-06 18:19:00',11,11.0,11,11,11,11.0,true ,'11','11') sql insert into tb3_2 values ('2021-02-06 18:19:01',12,12.0,12,12,12,12.0,true ,'12','12') sql insert into tb3_2 values ('2021-03-06 18:19:02',13,13.0,13,13,13,13.0,false,'13','13') @@ -87,9 +84,7 @@ sql insert into tb3_2 values ('2021-05-06 18:19:28',15,NULL,15,NULL,15,NULL,true sql insert into tb3_2 values ('2021-06-06 18:19:28',NULL,16.0,NULL,16,NULL,16.0,NULL,'16',NULL) sql insert into tb3_2 values ('2021-07-06 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) - sql create table stb4 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9),c10 binary(16300)) TAGS(t1 int, t2 binary(10), t3 double) - sql create table tb4_0 using stb4 tags(0,'0',0.0) sql create table tb4_1 using stb4 tags(1,'1',1.0) sql create table tb4_2 using stb4 tags(2,'2',2.0) @@ -128,19 +123,13 @@ while $i < $blockNum $ts0 = $ts0 + 259200000 endw -sleep 100 - -sql connect - run tsim/parser/condition_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 100 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect -sleep 100 run tsim/parser/condition_query.sim diff --git a/tests/script/tsim/parser/condition_query.sim b/tests/script/tsim/parser/condition_query.sim index 8dfa8dae0c..dc5eed49be 100644 --- a/tests/script/tsim/parser/condition_query.sim +++ b/tests/script/tsim/parser/condition_query.sim @@ -11,14 +11,14 @@ if $rows != 28 then return -1 endi -sql_error select * from stb1 where c8 > 0 -sql_error select * from stb1 where c7 in (0,2,3,1); -sql_error select * from stb1 where c8 in (true); -sql_error select * from stb1 where c8 in (1,2); -sql_error select * from stb1 where t2 in (3.0); -sql_error select ts,c1,c7 from stb1 where c7 > false -sql_error select * from stb1 where c1 > NULL; -sql_error select * from stb1 where c1 = NULL; +sql select * from stb1 where c8 > 0 +sql select * from stb1 where c7 in (0,2,3,1); +sql select * from stb1 where c8 in (true); +sql select * from stb1 where c8 in (1,2); +sql select * from stb1 where t2 in (3.0); +sql select ts,c1,c7 from stb1 where c7 > false +sql select * from stb1 where c1 > NULL; +sql select * from stb1 where c1 = NULL; sql_error select * from stb1 where c1 LIKE '%1'; sql_error select * from stb1 where c2 LIKE '%1'; sql_error select * from stb1 where c3 LIKE '%1'; @@ -26,20 +26,20 @@ sql_error select * from stb1 where c4 LIKE '%1'; sql_error select * from stb1 where c5 LIKE '%1'; sql_error select * from stb1 where c6 LIKE '%1'; sql_error select * from stb1 where c7 LIKE '%1'; -sql_error select * from stb1 where c1 = 'NULL'; -sql_error select * from stb1 where c2 > 'NULL'; -sql_error select * from stb1 where c3 <> 'NULL'; -sql_error select * from stb1 where c4 != 'null'; -sql_error select * from stb1 where c5 >= 'null'; -sql_error select * from stb1 where c6 <= 'null'; -sql_error select * from stb1 where c7 < 'nuLl'; -sql_error select * from stb1 where c8 < 'nuLl'; -sql_error select * from stb1 where c9 > 'nuLl'; +sql select * from stb1 where c1 = 'NULL'; +sql select * from stb1 where c2 > 'NULL'; +sql select * from stb1 where c3 <> 'NULL'; +sql select * from stb1 where c4 != 'null'; +sql select * from stb1 where c5 >= 'null'; +sql select * from stb1 where c6 <= 'null'; +sql select * from stb1 where c7 < 'nuLl'; +sql select * from stb1 where c8 < 'nuLl'; +sql select * from stb1 where c9 > 'nuLl'; sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b; sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60; sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and ((a.c1 > 50 and a.c1 < 60) or (b.c2 > 60)); -sql_error select * from stb1 where 'c2' is null; -sql_error select * from stb1 where 'c2' is not null; +sql select * from stb1 where 'c2' is null; +sql select * from stb1 where 'c2' is not null; sql select * from stb1 where c2 > 3.0 or c2 < 60; if $rows != 28 then @@ -173,7 +173,6 @@ if $data32 != 0 then return -1 endi - sql select ts,c1,c7 from stb1 where c7 = true if $rows != 14 then return -1 diff --git a/tests/script/tsim/parser/create_mt.sim b/tests/script/tsim/parser/create_mt.sim index fafee66c76..8f0c0e030b 100644 --- a/tests/script/tsim/parser/create_mt.sim +++ b/tests/script/tsim/parser/create_mt.sim @@ -69,7 +69,8 @@ sql_error create table $mt (ts $i_ts , col int) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_binary ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_bigint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_smallint ) tags (tag1 int) -sql_error create table $mt (ts timestamp, col $i_binary2 ) tags (tag1 int) +sql create table $mt (ts timestamp, col $i_binary2 ) tags (tag1 int) +sql drop table $mt sql_error create table $mt (ts timestamp, col $i_tinyint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_nchar ) tags (tag1 int) @@ -101,7 +102,8 @@ sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bigint ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_smallint ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_tinyint ) -sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary2 ) +sql create table $mt (ts timestamp, col int) tags (tag1 $i_binary2 ) +sql drop table $mt sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bool ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $nchar ) # correct use of nchar in tags @@ -144,7 +146,8 @@ sql_error create table $mt (ts timestamp, col1 int) tags ( $ses int) sql_error create table $mt (ts timestamp, col1 int) tags ( $int int) sql_error create table $mt (ts timestamp, col1 int) tags ( $bint int) sql_error create table $mt (ts timestamp, col1 int) tags ( $binary int) -sql_error create table $mt (ts timestamp, col1 int) tags ( $str int) +sql create table $mt (ts timestamp, col1 int) tags ( $str int) +sql drop table $mt sql_error create table $mt (ts timestamp, col1 int) tags ( $tag int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tags int) sql_error create table $mt (ts timestamp, col1 int) tags ( $sint int) @@ -162,8 +165,8 @@ sql create table $tb using $mt tags (-1) # -x ng_tag_v # return -1 #ng_tag_v: -sql select tg from $tb -if $data00 != -1 then +sql show tags from $tb +if $data05 != -1 then return -1 endi sql drop table $tb @@ -172,28 +175,21 @@ sql drop table $tb print create_mt.sim unmatched_tag_types sql reset query cache sql create table $tb using $mt tags ('123') -sql select tg from $tb -print data00 = $data00 -if $data00 != 123 then +sql show tags from $tb +print data05 = $data05 +if $data05 != 123 then return -1 endi sql drop table $tb + sql_error create table $tb using $mt tags (abc) #the case below might need more consideration sql_error create table $tb using $mt tags ('abc') sql drop table if exists $tb sql reset query cache -sql create table $tb using $mt tags (1e1) -sql select tg from $tb -if $data00 != 10 then - return -1 -endi -sql drop table $tb -sql create table $tb using $mt tags ('1e1') -sql select tg from $tb -if $data00 != 10 then - return -1 -endi +sql_error create table $tb using $mt tags (1e1) + +sql_error create table $tb using $mt tags ('1e1') sql_error create table $tb using $mt tags (2147483649) ## case: chinese_char_in_metric @@ -245,7 +241,7 @@ print chinese_char_in_metrics test passed sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/create_tb.sim b/tests/script/tsim/parser/create_tb.sim index 5203f289dc..384c8f8757 100644 --- a/tests/script/tsim/parser/create_tb.sim +++ b/tests/script/tsim/parser/create_tb.sim @@ -66,7 +66,8 @@ sql_error create table $tb (ts timestamp, col $i_binary ) sql_error create table $tb (ts timestamp, col $i_bigint ) sql_error create table $tb (ts timestamp, col $i_smallint ) sql_error create table $tb (ts timestamp, col $i_tinyint ) -sql_error create table $tb (ts timestamp, col $i_binary2 ) +sql create table $tb (ts timestamp, col $i_binary2 ) +sql drop table $tb sql_error create table $tb (ts timestamp, col $nchar ) sql create table $tb (ts timestamp, col nchar(20)) sql show tables @@ -105,7 +106,8 @@ sql_error create table $tb (ts timestamp, $ses int) sql_error create table $tb (ts timestamp, $int int) sql_error create table $tb (ts timestamp, $bint int) sql_error create table $tb (ts timestamp, $binary int) -sql_error create table $tb (ts timestamp, $str int) +sql create table $tb (ts timestamp, $str int) +sql drop table $tb sql_error create table $tb (ts timestamp, $tag int) sql_error create table $tb (ts timestamp, $tags int) sql_error create table $tb (ts timestamp, $sint int) @@ -157,7 +159,7 @@ print chinese_char_in_table_support test passed print ========== create_tb.sim case6: table_already_exists sql create table tbs (ts timestamp, col int) sql insert into tbs values (now, 1) -sql create table tbs (ts timestamp, col bool) +sql_error create table tbs (ts timestamp, col bool) #sql_error create table tb (ts timestamp, col bool) print table_already_exists test passed @@ -179,7 +181,7 @@ print table_already_exists test passed sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/dbtbnameValidate.sim b/tests/script/tsim/parser/dbtbnameValidate.sim index 86ffbe5c37..939bc0ac4d 100644 --- a/tests/script/tsim/parser/dbtbnameValidate.sim +++ b/tests/script/tsim/parser/dbtbnameValidate.sim @@ -5,77 +5,72 @@ sql connect print ========== db name and table name check in create and drop, describe sql create database abc keep 36500 -sql create database 'abc123' -sql create database '_ab1234' -sql create database 'ABC123' -sql create database '_ABC123' +sql_error create database 'abc123' +sql_error create database '_ab1234' +sql_error create database 'ABC123' +sql_error create database '_ABC123' sql_error create database 'aABb123 ' sql_error create database ' xyz ' sql_error create database ' XYZ ' -sql use 'abc123' -sql use '_ab1234' -sql use 'ABC123' -sql use '_ABC123' +sql_error use 'abc123' +sql_error use '_ab1234' +sql_error use 'ABC123' +sql_error use '_ABC123' sql_error use 'aABb123' sql_error use ' xyz ' sql_error use ' XYZ ' -sql drop database 'abc123' -sql drop database '_ab1234' -sql_error drop database 'ABC123' -sql drop database '_ABC123' -sql_error drop database 'aABb123' -sql_error drop database ' xyz ' -sql_error drop database ' XYZ ' - +sql_error drop database if exists 'abc123' +sql_error drop database if exists '_ab1234' +sql_error drop database if exists 'ABC123' +sql_error drop database if exists '_ABC123' +sql_error drop database if exists 'aABb123' +sql_error drop database if exists ' xyz ' +sql_error drop database if exists ' XYZ ' sql use abc - sql create table abc.cc (ts timestamp, c int) -sql create table 'abc.Dd' (ts timestamp, c int) -sql create table 'abc'.ee (ts timestamp, c int) -sql create table 'abc'.'FF' (ts timestamp, c int) -sql create table abc.'gG' (ts timestamp, c int) - +sql_error create table 'abc.Dd' (ts timestamp, c int) +sql_error create table 'abc'.ee (ts timestamp, c int) +sql_error create table 'abc'.'FF' (ts timestamp, c int) +sql_error create table abc.'gG' (ts timestamp, c int) sql_error create table table.'a1' (ts timestamp, c int) sql_error create table 'table'.'b1' (ts timestamp, c int) sql_error create table 'table'.'b1' (ts timestamp, c int) - sql create table mt (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double) sql create table sub_001 using mt tags ( 1 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.1 ) sql_error create table sub_002 using mt tags( 2 , tag_nchar , tag_bianry , 4 , 5 , 6.2 ) sql insert into sub_dy_tbl using mt tags ( 3 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.3 ) values (now, 1, 2, 3.01, 4.02, 5, 6, true, 'binary_8', 'nchar_9') sql describe abc.cc -sql describe 'abc.Dd' -sql describe 'abc'.ee -sql describe 'abc'.'FF' -sql describe abc.'gG' +sql_error describe 'abc.Dd' +sql_error describe 'abc'.ee +sql_error describe 'abc'.'FF' +sql_error describe abc.'gG' sql describe cc -sql describe 'Dd' -sql describe ee -sql describe 'FF' -sql describe 'gG' +sql_error describe 'Dd' +sql_error describe ee +sql_error describe 'FF' +sql_error describe 'gG' sql describe mt sql describe sub_001 sql describe sub_dy_tbl -sql describe Dd -sql describe FF -sql describe gG +sql_error describe Dd +sql_error describe FF +sql_error describe gG sql drop table abc.cc -sql drop table 'abc.Dd' -sql drop table 'abc'.ee -sql drop table 'abc'.'FF' -sql drop table abc.'gG' +sql_error drop table 'abc.Dd' +sql_error drop table 'abc'.ee +sql_error drop table 'abc'.'FF' +sql_error drop table abc.'gG' sql drop table sub_001 - sql drop table sub_dy_tbl sql drop table mt diff --git a/tests/script/tsim/parser/distinct.sim b/tests/script/tsim/parser/distinct.sim index b90ca593ba..6d7dec0659 100644 --- a/tests/script/tsim/parser/distinct.sim +++ b/tests/script/tsim/parser/distinct.sim @@ -73,11 +73,10 @@ if $rows != 6 then return -1 endi - ### select distinct sql drop database $db sql show databases -if $rows != 0 then +if $rows != 2 then return -1 endi