diff --git a/tests/script/general/alter/cached_schema_after_alter.sim b/tests/script/general/alter/cached_schema_after_alter.sim index 96ee439084..043f360856 100644 --- a/tests/script/general/alter/cached_schema_after_alter.sim +++ b/tests/script/general/alter/cached_schema_after_alter.sim @@ -1,9 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect $db = csaa_db diff --git a/tests/script/general/alter/dnode.sim b/tests/script/general/alter/dnode.sim index 7b31218fc2..64e8a17de0 100644 --- a/tests/script/general/alter/dnode.sim +++ b/tests/script/general/alter/dnode.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/import.sim b/tests/script/general/alter/import.sim index aef0a258b2..175e084b7f 100644 --- a/tests/script/general/alter/import.sim +++ b/tests/script/general/alter/import.sim @@ -1,13 +1,8 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 print ========= start dnode1 as master system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/insert1.sim b/tests/script/general/alter/insert1.sim index 12ab09beb9..82781f2fe5 100644 --- a/tests/script/general/alter/insert1.sim +++ b/tests/script/general/alter/insert1.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/insert2.sim b/tests/script/general/alter/insert2.sim index dcd9f50030..a30175f398 100644 --- a/tests/script/general/alter/insert2.sim +++ b/tests/script/general/alter/insert2.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/metrics.sim b/tests/script/general/alter/metrics.sim index fd0b210cd1..ec8c980c16 100644 --- a/tests/script/general/alter/metrics.sim +++ b/tests/script/general/alter/metrics.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/table.sim b/tests/script/general/alter/table.sim index 06704eeca6..cd03977602 100644 --- a/tests/script/general/alter/table.sim +++ b/tests/script/general/alter/table.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 2 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/general/alter/testSuite.sim b/tests/script/general/alter/testSuite.sim deleted file mode 100644 index cfac68144c..0000000000 --- a/tests/script/general/alter/testSuite.sim +++ /dev/null @@ -1,7 +0,0 @@ -run general/alter/cached_schema_after_alter.sim -run general/alter/count.sim -run general/alter/import.sim -run general/alter/insert1.sim -run general/alter/insert2.sim -run general/alter/metrics.sim -run general/alter/table.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 198b9007d7..f3bb043f52 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -88,7 +88,6 @@ ./test.sh -f tsim/tmq/topic.sim # --- stable -./test.sh -f tsim/stable/alter1.sim ./test.sh -f tsim/stable/disk.sim ./test.sh -f tsim/stable/dnode3.sim ./test.sh -f tsim/stable/metrics.sim @@ -98,8 +97,12 @@ ./test.sh -f tsim/stable/vnode3.sim ./test.sh -f tsim/stable/column_add.sim ./test.sh -f tsim/stable/column_drop.sim -#./test.sh -f tsim/stable/column_modify.sim - +./test.sh -f tsim/stable/column_modify.sim +./test.sh -f tsim/stable/tag_add.sim +./test.sh -f tsim/stable/tag_drop.sim +./test.sh -f tsim/stable/tag_modify.sim +./test.sh -f tsim/stable/tag_rename.sim +./test.sh -f tsim/stable/alter_comment.sim # --- for multi process mode ./test.sh -f tsim/user/basic1.sim -m diff --git a/tests/script/tsim/stable/alter1.sim b/tests/script/tsim/stable/alter_comment.sim similarity index 99% rename from tests/script/tsim/stable/alter1.sim rename to tests/script/tsim/stable/alter_comment.sim index 1205f50f6e..cfcbb9a1da 100644 --- a/tests/script/tsim/stable/alter1.sim +++ b/tests/script/tsim/stable/alter_comment.sim @@ -166,4 +166,5 @@ if $data[0][6] != abcde then return -1 endi +return system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/alter/count.sim b/tests/script/tsim/stable/alter_count.sim similarity index 97% rename from tests/script/general/alter/count.sim rename to tests/script/tsim/stable/alter_count.sim index fc936668b8..9c9ece7ee4 100644 --- a/tests/script/general/alter/count.sim +++ b/tests/script/tsim/stable/alter_count.sim @@ -1,13 +1,8 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 -system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4 print ========= start dnode1 as master system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print ======== step1 @@ -141,10 +136,11 @@ endi print ============= step10 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 +sql connect +sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from d1.tb; +sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from d1.tb; sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb if $data00 != 24 then return -1 diff --git a/tests/script/tsim/stable/column_modify.sim b/tests/script/tsim/stable/column_modify.sim index 732e449c4a..16e7ff8f67 100644 --- a/tests/script/tsim/stable/column_modify.sim +++ b/tests/script/tsim/stable/column_modify.sim @@ -47,7 +47,7 @@ endi print ========== step2 describe sql describe db.ctb -if $rows != 7 then +if $rows != 6 then return -1 endi if $data[0][0] != ts then @@ -75,4 +75,32 @@ if $data[5][0] != t3 then return -1 endi +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +sql connect +sql select * from db.ctb + +if $rows != 2 then + return -1 +endi +#if $data[0][1] != 1 then +# return -1 +#endi +#if $data[0][2] != 1234 then +# return -1 +#endi +#if $data[0][3] != 101 then +# return -1 +#endi +#if $data[1][1] != 1 then +# return -1 +#endi +#if $data[1][2] != 12345 then +# return -1 +#endi +#if $data[1][3] != 101 then +# return -1 +#endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stable/disk.sim b/tests/script/tsim/stable/disk.sim index c1ced6ae10..eeaa8293a5 100644 --- a/tests/script/tsim/stable/disk.sim +++ b/tests/script/tsim/stable/disk.sim @@ -1,17 +1,9 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start - $dbPrefix = d_db $tbPrefix = d_tb $mtPrefix = d_mt @@ -59,9 +51,8 @@ endi sleep 1000 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 +sleep 1000 system sh/exec.sh -n dnode1 -s start -sleep 6000 sql use $db sql show vgroups diff --git a/tests/script/tsim/stable/dnode3.sim b/tests/script/tsim/stable/dnode3.sim index 706c4aa499..03e8df26b7 100644 --- a/tests/script/tsim/stable/dnode3.sim +++ b/tests/script/tsim/stable/dnode3.sim @@ -1,19 +1,9 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode3 -i 3 system sh/deploy.sh -n dnode4 -i 4 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode2 -c walLevel -v 1 -system sh/cfg.sh -n dnode3 -c walLevel -v 1 -system sh/cfg.sh -n dnode4 -c walLevel -v 1 -# system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -# system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 4 -# system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4 -# system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - sql connect sql create dnode $hostname PORT 7200 diff --git a/tests/script/tsim/stable/metrics.sim b/tests/script/tsim/stable/metrics.sim index e68d95511c..26323b4a92 100644 --- a/tests/script/tsim/stable/metrics.sim +++ b/tests/script/tsim/stable/metrics.sim @@ -1,10 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 1000 sql connect $dbPrefix = m_me_db diff --git a/tests/script/tsim/stable/refcount.sim b/tests/script/tsim/stable/refcount.sim index fffa6f75a4..d77c8e0890 100644 --- a/tests/script/tsim/stable/refcount.sim +++ b/tests/script/tsim/stable/refcount.sim @@ -1,11 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print =============== step1 diff --git a/tests/script/tsim/stable/show.sim b/tests/script/tsim/stable/show.sim index 823aefe9d8..d3ab75adf5 100644 --- a/tests/script/tsim/stable/show.sim +++ b/tests/script/tsim/stable/show.sim @@ -1,14 +1,9 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== create stable - sql create database d1 sql use d1 diff --git a/tests/script/tsim/stable/tag_add.sim b/tests/script/tsim/stable/tag_add.sim new file mode 100644 index 0000000000..01cc7bc36c --- /dev/null +++ b/tests/script/tsim/stable/tag_add.sim @@ -0,0 +1,193 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== prepare stb and ctb +sql create database db vgroups 1 +sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd" +sql create table db.ctb using db.stb tags(101, "102") +sql insert into db.ctb values(now, 1, "2") + +sql show db.stables +if $rows != 1 then + return -1 +endi +if $data[0][0] != stb then + return -1 +endi +if $data[0][1] != db then + return -1 +endi +if $data[0][3] != 3 then + return -1 +endi +if $data[0][4] != 2 then + return -1 +endi +if $data[0][6] != abd then + return -1 +endi + +sql show db.tables +if $rows != 1 then + return -1 +endi +if $data[0][0] != ctb then + return -1 +endi +if $data[0][1] != db then + return -1 +endi +if $data[0][3] != 3 then + return -1 +endi +if $data[0][4] != stb then + return -1 +endi +if $data[0][6] != 2 then + return -1 +endi +if $data[0][9] != CHILD_TABLE then + return -1 +endi + +sql select * from db.stb +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 102 then + return -1 +endi + +sql_error alter table db.stb add tag ts int +sql_error alter table db.stb add tag t1 int +sql_error alter table db.stb add tag t2 int +sql_error alter table db.stb add tag c1 int +sql_error alter table db.stb add tag c2 int + +print ========== step1 add tag t3 +sql alter table db.stb add tag t3 int + +sql show db.stables +if $data[0][3] != 3 then + return -1 +endi + +sql show db.tables +if $data[0][3] != 3 then + return -1 +endi + +sql describe db.ctb +if $rows != 6 then + return -1 +endi +if $data[5][0] != t3 then + return -1 +endi +if $data[5][1] != INT then + return -1 +endi +if $data[5][2] != 4 then + return -1 +endi + +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 102 then + return -1 +endi +if $data[0][5] != NULL then + return -1 +endi + +print ========== step2 add tag t4 +sql alter table db.stb add tag t4 bigint +sql select * from db.stb +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 102 then + return -1 +endi +if $data[0][5] != NULL then + return -1 +endi +if $data[0][6] != NULL then + return -1 +endi + +sql_error create table db.ctb2 using db.stb tags(101, "102") +sql create table db.ctb2 using db.stb tags(101, "102", 103, 104) +sql insert into db.ctb2 values(now, 1, "2") + +sql select * from db.stb where tbname = 'ctb2'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 102 then + return -1 +endi +if $data[0][5] != 103 then + return -1 +endi +if $data[0][6] != 104 then + return -1 +endi + +print ========== step3 describe +sql describe db.ctb +if $rows != 7 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stable/tag_drop.sim b/tests/script/tsim/stable/tag_drop.sim new file mode 100644 index 0000000000..afac59daff --- /dev/null +++ b/tests/script/tsim/stable/tag_drop.sim @@ -0,0 +1,337 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== prepare stb and ctb +sql create database db vgroups 1 +sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd" +sql create table db.ctb using db.stb tags(101, "102") +sql insert into db.ctb values(now, 1, "2") + +sql show db.stables +if $rows != 1 then + return -1 +endi +if $data[0][0] != stb then + return -1 +endi +if $data[0][1] != db then + return -1 +endi +if $data[0][3] != 3 then + return -1 +endi +if $data[0][4] != 2 then + return -1 +endi +if $data[0][6] != abd then + return -1 +endi + +sql show db.tables +if $rows != 1 then + return -1 +endi +if $data[0][0] != ctb then + return -1 +endi +if $data[0][1] != db then + return -1 +endi +if $data[0][3] != 3 then + return -1 +endi +if $data[0][4] != stb then + return -1 +endi +if $data[0][6] != 2 then + return -1 +endi +if $data[0][9] != CHILD_TABLE then + return -1 +endi + +sql select * from db.stb +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 102 then + return -1 +endi + +sql_error alter table db.stb drop tag ts int +sql_error alter table db.stb drop tag t3 int +sql_error alter table db.stb drop tag t4 int +sql_error alter table db.stb drop tag c1 int +sql_error alter table db.stb drop tag c2 int + +print ========== step1 drop tag t2 +sql alter table db.stb drop tag t2 + +sql show db.stables +if $data[0][4] != 1 then + return -1 +endi + +sql describe db.ctb +if $rows != 4 then + return -1 +endi +if $data[4][0] != null then + return -1 +endi + +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != null then + return -1 +endi + +print ========== step2 add tag t3 +sql alter table db.stb add tag t3 int + +sql show db.stables +if $data[0][4] != 2 then + return -1 +endi + +sql describe db.ctb +if $rows != 5 then + return -1 +endi +if $data[4][0] != t3 then + return -1 +endi +if $data[4][1] != INT then + return -1 +endi +if $data[4][2] != 4 then + return -1 +endi + +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != NULL then + return -1 +endi + +print ========== step3 add tag t4 +sql alter table db.stb add tag t4 bigint +sql select * from db.stb +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != NULL then + return -1 +endi +if $data[0][5] != NULL then + return -1 +endi +if $data[0][6] != null then + return -1 +endi + +sql_error create table db.ctb2 using db.stb tags(101, "102") +sql create table db.ctb2 using db.stb tags(201, 202, 203) +sql insert into db.ctb2 values(now, 1, "2") + +sql select * from db.stb where tbname = 'ctb2'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 201 then + return -1 +endi +if $data[0][4] != 202 then + return -1 +endi +if $data[0][5] != 203 then + return -1 +endi + +print ========== step4 describe +sql describe db.ctb +if $rows != 6 then + return -1 +endi + +print ========== step5 add tag2 +sql alter table db.stb add tag t2 bigint +sql select * from db.stb where tbname = 'ctb2'; +sql select * from db.stb where tbname = 'ctb2'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 201 then + return -1 +endi +if $data[0][4] != 202 then + return -1 +endi +if $data[0][5] != 203 then + return -1 +endi +if $data[0][6] != NULL then + return -1 +endi + +sql_error create table db.ctb2 using db.stb tags(101, "102") +sql_error create table db.ctb2 using db.stb tags(201, 202, 203) +sql create table db.ctb3 using db.stb tags(301, 302, 303, 304) +sql insert into db.ctb3 values(now, 1, "2") + +sql select * from db.stb where tbname = 'ctb3'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 301 then + return -1 +endi +if $data[0][4] != 302 then + return -1 +endi +if $data[0][5] != 303 then + return -1 +endi +if $data[0][6] != 304 then + return -1 +endi + +print ========== step6 describe +sql describe db.ctb +if $rows != 7 then + return -1 +endi + +if $data[3][0] != t1 then + return -1 +endi +if $data[4][0] != t3 then + return -1 +endi +if $data[5][0] != t4 then + return -1 +endi +if $data[6][0] != t2 then + return -1 +endi +if $data[6][1] != BIGINT then + return -1 +endi + +print ========== step7 drop tag t1 +sql alter table db.stb drop tag t1 + +sql show db.stables +if $data[0][4] != 3 then + return -1 +endi + +sql describe db.ctb +if $rows != 6 then + return -1 +endi + +sql select * from db.stb where tbname = 'ctb3'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 2 then + return -1 +endi +if $data[0][3] != 302 then + return -1 +endi +if $data[0][4] != 303 then + return -1 +endi +if $data[0][5] != 304 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stable/tag_modify.sim b/tests/script/tsim/stable/tag_modify.sim new file mode 100644 index 0000000000..62e4c7b282 --- /dev/null +++ b/tests/script/tsim/stable/tag_modify.sim @@ -0,0 +1,123 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== prepare stb and ctb +sql create database db vgroups 1 +sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(4)) comment "abd" + +sql_error alter table db.stb MODIFY tag c2 binary(3) +sql_error alter table db.stb MODIFY tag c2 int +sql_error alter table db.stb MODIFY tag c1 int +sql_error alter table db.stb MODIFY tag ts int +sql_error alter table db.stb MODIFY tag t2 binary(3) +sql_error alter table db.stb MODIFY tag t2 int +sql_error alter table db.stb MODIFY tag t1 int +sql create table db.ctb using db.stb tags(101, "12345") +sql insert into db.ctb values(now, 1, "1234") + +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 1234 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 1234 then + return -1 +endi + +print ========== step1 modify tag +sql alter table db.stb MODIFY tag t2 binary(5) +sql select * from db.stb + +sql create table db.ctb2 using db.stb tags(101, "12345") +sql insert into db.ctb2 values(now, 1, "1234") + +sql select * from db.stb where tbname = 'ctb2'; +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 1234 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 12345 then + return -1 +endi + +print ========== step2 describe +sql describe db.ctb2 +if $rows != 5 then + return -1 +endi +if $data[0][0] != ts then + return -1 +endi +if $data[1][0] != c1 then + return -1 +endi +if $data[2][0] != c2 then + return -1 +endi +if $data[3][0] != t1 then + return -1 +endi +if $data[4][0] != t2 then + return -1 +endi +if $data[4][1] != VARCHAR then + return -1 +endi +if $data[4][2] != 5 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +sql connect +sql describe db.ctb2 +if $rows != 5 then + return -1 +endi +if $data[0][0] != ts then + return -1 +endi +if $data[1][0] != c1 then + return -1 +endi +if $data[2][0] != c2 then + return -1 +endi +if $data[3][0] != t1 then + return -1 +endi +if $data[4][0] != t2 then + return -1 +endi +if $data[4][1] != VARCHAR then + return -1 +endi +if $data[4][2] != 5 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stable/tag_rename.sim b/tests/script/tsim/stable/tag_rename.sim new file mode 100644 index 0000000000..2f67a3ab2c --- /dev/null +++ b/tests/script/tsim/stable/tag_rename.sim @@ -0,0 +1,120 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== prepare stb and ctb +sql create database db vgroups 1 +sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(4)) comment "abd" + +sql_error alter table db.stb rename tag c2 c3 +sql_error alter table db.stb rename tag c2 c3 +sql_error alter table db.stb rename tag c1 c3 +sql_error alter table db.stb rename tag ts c3 +sql_error alter table db.stb rename tag t2 t1 +sql_error alter table db.stb rename tag t2 t2 +sql_error alter table db.stb rename tag t1 t2 +sql create table db.ctb using db.stb tags(101, "12345") +sql insert into db.ctb values(now, 1, "1234") + +sql select * from db.stb +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 1234 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 1234 then + return -1 +endi + +print ========== step1 rename tag +sql alter table db.stb rename tag t1 t3 +sql select * from db.stb +sql select * from db.stb + +print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6] +print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6] + +if $rows != 1 then + return -1 +endi +if $data[0][1] != 1 then + return -1 +endi +if $data[0][2] != 1234 then + return -1 +endi +if $data[0][3] != 101 then + return -1 +endi +if $data[0][4] != 1234 then + return -1 +endi + +print ========== step2 describe +sql describe db.ctb +if $rows != 5 then + return -1 +endi +if $data[0][0] != ts then + return -1 +endi +if $data[1][0] != c1 then + return -1 +endi +if $data[2][0] != c2 then + return -1 +endi +if $data[3][0] != t3 then + return -1 +endi +if $data[4][0] != t2 then + return -1 +endi +if $data[4][1] != VARCHAR then + return -1 +endi +if $data[4][2] != 4 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start + +sql connect +sql describe db.ctb +if $rows != 5 then + return -1 +endi +if $data[0][0] != ts then + return -1 +endi +if $data[1][0] != c1 then + return -1 +endi +if $data[2][0] != c2 then + return -1 +endi +if $data[3][0] != t3 then + return -1 +endi +if $data[4][0] != t2 then + return -1 +endi +if $data[4][1] != VARCHAR then + return -1 +endi +if $data[4][2] != 4 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/stable/values.sim b/tests/script/tsim/stable/values.sim index e5e3118e12..88eca28a12 100644 --- a/tests/script/tsim/stable/values.sim +++ b/tests/script/tsim/stable/values.sim @@ -1,16 +1,9 @@ system sh/stop_dnodes.sh - - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start - sql create database vdb0 sql create table vdb0.mt (ts timestamp, tbcol int) TAGS(tgcol int) diff --git a/tests/script/tsim/stable/vnode3.sim b/tests/script/tsim/stable/vnode3.sim index 97a8203883..186d0f5eea 100644 --- a/tests/script/tsim/stable/vnode3.sim +++ b/tests/script/tsim/stable/vnode3.sim @@ -1,16 +1,9 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 -system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4 -system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4 system sh/exec.sh -n dnode1 -s start - -sleep 2000 sql connect print ======================== dnode1 start - $dbPrefix = v3_db $tbPrefix = v3_tb $mtPrefix = v3_mt diff --git a/tests/script/tsim/valgrind/checkError.sim b/tests/script/tsim/valgrind/checkError.sim index 97d16dba96..5790437a67 100644 --- a/tests/script/tsim/valgrind/checkError.sim +++ b/tests/script/tsim/valgrind/checkError.sim @@ -71,7 +71,7 @@ print ====> start to check if there are ERRORS in vagrind log file for each dnod # -n : dnode[x] be check system_content sh/checkValgrind.sh -n dnode1 print cmd return result----> [ $system_content ] -if $system_content <= 1 then +if $system_content <= 3 then return 0 endi