From c257f23036546f8b3b7effb765b3cccee9105326 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 28 Apr 2022 15:36:19 +0800 Subject: [PATCH] enh: adjust test cases after refactor db options --- tests/script/tsim/db/alter_option.sim | 73 ++++++++++--------- tests/script/tsim/db/create_all_options.sim | 70 +++++++++--------- tests/script/tsim/sync/oneReplica1VgElect.sim | 2 +- .../sync/oneReplica1VgElectWithInsert.sim | 2 +- .../script/tsim/sync/threeReplica1VgElect.sim | 2 +- .../sync/threeReplica1VgElectWihtInsert.sim | 2 +- .../script/tsim/tmq/prepareBasicEnv-1vgrp.sim | 2 +- .../script/tsim/tmq/prepareBasicEnv-4vgrp.sim | 2 +- 8 files changed, 78 insertions(+), 77 deletions(-) diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index b847149be3..417e53daff 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -58,11 +58,11 @@ endi print ============= create database #database_option: { -# BLOCKS value [3~1000, default: 6] +# | BUFFER value [3~16384, default: 96] +# | PAGES value [64~16384, default: 256] # | CACHELAST value [0, 1, 2, 3] # | FSYNC value [0 ~ 180000 ms] # | KEEP value [days, 365000] -# | QUORUM value [1 | 2] # | REPLICA value [1 | 3] # | WAL value [1 | 2] @@ -98,31 +98,34 @@ endi if $data7_db != 1440000,1440000,1440000 then # keep return -1 endi -#if $data8_db != 3 then # cache -# return -1 -#endi -#if $data9_db != 7 then # blocks -# return -1 -#endi -if $data10_db != 10 then # minrows +if $data8_db != 96 then # buffer + return -1 +endi +if $data9_db != 4 then # pagesize + return -1 +endi +if $data10_db != 256 then # pages + return -1 +endi +if $data11_db != 10 then # minrows return -1 endi -if $data11_db != 8000 then # maxrows +if $data12_db != 8000 then # maxrows return -1 endi -if $data12_db != 2 then # wal +if $data13_db != 2 then # wal return -1 endi -if $data13_db != 1000 then # fsync +if $data14_db != 1000 then # fsync return -1 endi -if $data14_db != 0 then # comp +if $data15_db != 0 then # comp return -1 endi -if $data15_db != 3 then # cachelast +if $data16_db != 3 then # cachelast return -1 endi -if $data16_db != ns then # precision +if $data17_db != ns then # precision return -1 endi @@ -302,14 +305,14 @@ sql_error alter database db maxrows 10 # little than minrows print ============== step wal sql alter database db wal 1 sql show databases -print wal $data12_db -if $data12_db != 1 then +print wal $data13_db +if $data13_db != 1 then return -1 endi sql alter database db wal 2 sql show databases -print wal $data12_db -if $data12_db != 2 then +print wal $data13_db +if $data13_db != 2 then return -1 endi @@ -321,20 +324,20 @@ sql_error alter database db wal -1 print ============== modify fsync sql alter database db fsync 2000 sql show databases -print fsync $data13_db -if $data13_db != 2000 then +print fsync $data14_db +if $data14_db != 2000 then return -1 endi sql alter database db fsync 500 sql show databases -print fsync $data13_db -if $data13_db != 500 then +print fsync $data14_db +if $data14_db != 500 then return -1 endi sql alter database db fsync 0 sql show databases -print fsync $data13_db -if $data13_db != 0 then +print fsync $data14_db +if $data14_db != 0 then return -1 endi sql_error alter database db fsync 180001 @@ -353,32 +356,32 @@ sql_error alter database db comp -1 print ============== modify cachelast [0, 1, 2, 3] sql alter database db cachelast 2 sql show databases -print cachelast $data15_db -if $data15_db != 2 then +print cachelast $data16_db +if $data16_db != 2 then return -1 endi sql alter database db cachelast 1 sql show databases -print cachelast $data15_db -if $data15_db != 1 then +print cachelast $data16_db +if $data16_db != 1 then return -1 endi sql alter database db cachelast 0 sql show databases -print cachelast $data15_db -if $data15_db != 0 then +print cachelast $data16_db +if $data16_db != 0 then return -1 endi sql alter database db cachelast 2 sql show databases -print cachelast $data15_db -if $data15_db != 2 then +print cachelast $data16_db +if $data16_db != 2 then return -1 endi sql alter database db cachelast 3 sql show databases -print cachelast $data15_db -if $data15_db != 3 then +print cachelast $data16_db +if $data16_db != 3 then return -1 endi diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index ebb3716882..47e6962440 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -58,8 +58,9 @@ endi print ============= create database with all options #database_option: { -# | BLOCKS value [3~1000, default: 6] -# | CACHE value [default: 16] +# | BUFFER value [3~16384, default: 96] +# | PAGES value [64~16384, default: 256] +# | PAGESIZE value [1~16384, default: 4] # | CACHELAST value [0, 1, 2, 3, default: 0] # | COMP [0 | 1 | 2, default: 2] # | DAYS value [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day] @@ -68,24 +69,18 @@ print ============= create database with all options # | MINROWS value [10~1000, default: 100] # | KEEP value [max(1d ~ 365000d), default: 1d, unit may be minut/hour/day] # | PRECISION ['ms' | 'us' | 'ns', default: ms] -# | QUORUM value [1 | 2, default: 1] # | REPLICA value [1 | 3, default: 1] -# | TTL value [1d ~ , default: 1] # | WAL value [1 | 2, default: 1] # | VGROUPS value [default: 2] # | SINGLE_STABLE [0 | 1, default: ] -# | STREAM_MODE [0 | 1, default: ] # #$data0_db : name #$data1_db : create_time #$data2_db : vgroups #$data3_db : ntables #$data4_db : replica -#$data5_db : quorum #$data6_db : days #$data7_db : keep -#$data8_db : cache -#$data9_db : blocks #$data10_db : minrows #$data11_db : maxrows #$data12_db : wal @@ -124,31 +119,34 @@ endi if $data7_db != 5256000,5256000,5256000 then # keep return -1 endi -#if $data8_db != 16 then # cache -# return -1 -#endi -#if $data9_db != 6 then # blocks -# return -1 -#endi -if $data10_db != 100 then # minrows +if $data8_db != 96 then # buffer + return -1 +endi +if $data9_db != 4 then # pagesize + return -1 +endi +if $data10_db != 256 then # pages + return -1 +endi +if $data11_db != 100 then # minrows return -1 endi -if $data11_db != 4096 then # maxrows +if $data12_db != 4096 then # maxrows return -1 endi -if $data12_db != 1 then # wal +if $data13_db != 1 then # wal return -1 endi -if $data13_db != 3000 then # fsync +if $data14_db != 3000 then # fsync return -1 endi -if $data14_db != 2 then # comp +if $data15_db != 2 then # comp return -1 endi -if $data15_db != 0 then # cachelast +if $data16_db != 0 then # cachelast return -1 endi -if $data16_db != ms then # precision +if $data17_db != ms then # precision return -1 endi sql drop database db @@ -194,7 +192,7 @@ print ====> CACHELAST value [0, 1, 2, 3, default: 0] sql create database db CACHELAST 1 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data15_db != 1 then +if $data16_db != 1 then return -1 endi sql drop database db @@ -202,7 +200,7 @@ sql drop database db sql create database db CACHELAST 2 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data15_db != 2 then +if $data16_db != 2 then return -1 endi sql drop database db @@ -210,7 +208,7 @@ sql drop database db sql create database db CACHELAST 3 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data15_db != 3 then +if $data16_db != 3 then return -1 endi sql drop database db @@ -221,7 +219,7 @@ print ====> COMP [0 | 1 | 2, default: 2] sql create database db COMP 1 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data14_db != 1 then +if $data15_db != 1 then return -1 endi sql drop database db @@ -229,7 +227,7 @@ sql drop database db sql create database db COMP 0 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data14_db != 0 then +if $data15_db != 0 then return -1 endi sql drop database db @@ -280,7 +278,7 @@ print ====> FSYNC value [0 ~ 180000 ms, default: 3000] sql create database db FSYNC 0 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data13_db != 0 then +if $data14_db != 0 then return -1 endi sql drop database db @@ -288,7 +286,7 @@ sql drop database db sql create database db FSYNC 180000 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data13_db != 180000 then +if $data14_db != 180000 then return -1 endi sql drop database db @@ -299,10 +297,10 @@ print ====> MAXROWS value [200~10000, default: 4096], MINROWS value [10~1000, de sql create database db MAXROWS 10000 MINROWS 1000 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data10_db != 1000 then +if $data11_db != 1000 then return -1 endi -if $data11_db != 10000 then +if $data12_db != 10000 then return -1 endi sql drop database db @@ -310,10 +308,10 @@ sql drop database db sql create database db MAXROWS 200 MINROWS 10 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data10_db != 10 then +if $data11_db != 10 then return -1 endi -if $data11_db != 200 then +if $data12_db != 200 then return -1 endi sql drop database db @@ -331,7 +329,7 @@ print ====> PRECISION ['ms' | 'us' | 'ns', default: ms] sql create database db PRECISION 'us' sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data16_db != us then +if $data17_db != us then return -1 endi sql drop database db @@ -339,7 +337,7 @@ sql drop database db sql create database db PRECISION 'ns' sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data16_db != ns then +if $data17_db != ns then return -1 endi sql drop database db @@ -410,7 +408,7 @@ print ====> WAL value [1 | 2, default: 1] sql create database db WAL 2 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data12_db != 2 then +if $data13_db != 2 then return -1 endi sql drop database db @@ -418,7 +416,7 @@ sql drop database db sql create database db WAL 1 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db -if $data12_db != 1 then +if $data13_db != 1 then return -1 endi sql drop database db diff --git a/tests/script/tsim/sync/oneReplica1VgElect.sim b/tests/script/tsim/sync/oneReplica1VgElect.sim index 8e99bc4b2e..bb9b3f4496 100644 --- a/tests/script/tsim/sync/oneReplica1VgElect.sim +++ b/tests/script/tsim/sync/oneReplica1VgElect.sim @@ -83,7 +83,7 @@ print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $dat if $rows != 3 then return -1 endi -if $data(db)[20] != ready then +if $data(db)[19] != ready then goto check_db_ready endi diff --git a/tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim b/tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim index e85d5ea437..7ceeb2806b 100644 --- a/tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim +++ b/tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim @@ -83,7 +83,7 @@ print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $dat if $rows != 3 then return -1 endi -if $data(db)[20] != ready then +if $data(db)[19] != ready then goto check_db_ready endi diff --git a/tests/script/tsim/sync/threeReplica1VgElect.sim b/tests/script/tsim/sync/threeReplica1VgElect.sim index e06bd86daa..7f8c8339cb 100644 --- a/tests/script/tsim/sync/threeReplica1VgElect.sim +++ b/tests/script/tsim/sync/threeReplica1VgElect.sim @@ -83,7 +83,7 @@ print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $dat if $rows != 3 then return -1 endi -if $data(db)[20] != ready then +if $data(db)[19] != ready then goto check_db_ready endi diff --git a/tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim b/tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim index 797baea811..1e12e8565f 100644 --- a/tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim +++ b/tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim @@ -83,7 +83,7 @@ print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $dat if $rows != 3 then return -1 endi -if $data(db)[20] != ready then +if $data(db)[19] != ready then goto check_db_ready endi diff --git a/tests/script/tsim/tmq/prepareBasicEnv-1vgrp.sim b/tests/script/tsim/tmq/prepareBasicEnv-1vgrp.sim index db56bcf743..e32a1df802 100644 --- a/tests/script/tsim/tmq/prepareBasicEnv-1vgrp.sim +++ b/tests/script/tsim/tmq/prepareBasicEnv-1vgrp.sim @@ -39,7 +39,7 @@ sql show databases print ==> rows: $rows print ==> $data(db)[0] $data(db)[1] $data(db)[2] $data(db)[3] $data(db)[4] $data(db)[5] $data(db)[6] $data(db)[7] $data(db)[8] $data(db)[9] $data(db)[10] $data(db)[11] $data(db)[12] print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $data(db)[18] $data(db)[19] $data(db)[20] -if $data(db)[20] != nostrict then +if $data(db)[19] != nostrict then sleep 100 $loop_cnt = $loop_cnt + 1 goto check_db_ready diff --git a/tests/script/tsim/tmq/prepareBasicEnv-4vgrp.sim b/tests/script/tsim/tmq/prepareBasicEnv-4vgrp.sim index d7fa58558f..4750aab214 100644 --- a/tests/script/tsim/tmq/prepareBasicEnv-4vgrp.sim +++ b/tests/script/tsim/tmq/prepareBasicEnv-4vgrp.sim @@ -39,7 +39,7 @@ sql show databases print ==> rows: $rows print ==> $data(db)[0] $data(db)[1] $data(db)[2] $data(db)[3] $data(db)[4] $data(db)[5] $data(db)[6] $data(db)[7] $data(db)[8] $data(db)[9] $data(db)[10] $data(db)[11] $data(db)[12] print $data(db)[13] $data(db)[14] $data(db)[15] $data(db)[16] $data(db)[17] $data(db)[18] $data(db)[19] $data(db)[20] -if $data(db)[20] != nostrict then +if $data(db)[19] != nostrict then sleep 100 $loop_cnt = $loop_cnt + 1 goto check_db_ready -- GitLab