Skip to content

Commit

Permalink
[fix](testcase) fix miss used global variables in index testcases (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokang authored Apr 16, 2024
1 parent de8c435 commit 71c1a8f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ suite("test_decimal256_index") {
sql "set enable_nereids_planner = true;"
sql "set enable_decimal256 = true;"

def timeout = 60000
def delta_time = 1000
def alter_res = "null"
def useTime = 0
def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
Expand Down
27 changes: 12 additions & 15 deletions regression-test/suites/inverted_index_p0/test_show_data.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ suite("test_show_data", "p0") {
def testTableWithIndex = "test_show_data_httplogs_with_index"
def delta_time = 5000
def timeout = 60000
def alter_res = "null"
def useTime = 0
String database = context.config.getDbNameByFile(context.file)

def create_httplogs_table_without_index = {testTablex ->
Expand Down Expand Up @@ -99,7 +101,6 @@ suite("test_show_data", "p0") {
}

def wait_for_show_data_finish = { table_name, OpTimeout, origin_size ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def result = sql """show data from ${database}.${table_name};"""
if (result.size() > 0) {
Expand All @@ -117,9 +118,8 @@ suite("test_show_data", "p0") {
}

def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = alter_res.toString()
if(alter_res.contains("FINISHED")) {
sleep(3000) // wait change table state to normal
Expand All @@ -133,9 +133,8 @@ suite("test_show_data", "p0") {
}

def wait_for_last_build_index_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """
alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """

if (alter_res.size() == 0) {
return "FINISHED"
Expand Down Expand Up @@ -201,6 +200,8 @@ suite("test_show_data_for_bkd", "p0") {
def testTableWithBKDIndex = "test_show_data_httplogs_with_bkd_index"
def delta_time = 5000
def timeout = 60000
def alter_res = "null"
def useTime = 0
String database = context.config.getDbNameByFile(context.file)

def create_httplogs_table_without_bkd_index = {testTablex ->
Expand Down Expand Up @@ -279,7 +280,6 @@ suite("test_show_data_for_bkd", "p0") {
}

def wait_for_show_data_finish = { table_name, OpTimeout, origin_size ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def result = sql """show data from ${database}.${table_name};"""
if (result.size() > 0) {
Expand All @@ -297,9 +297,8 @@ suite("test_show_data_for_bkd", "p0") {
}

def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = alter_res.toString()
if(alter_res.contains("FINISHED")) {
sleep(3000) // wait change table state to normal
Expand All @@ -313,9 +312,8 @@ suite("test_show_data_for_bkd", "p0") {
}

def wait_for_last_build_index_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """
alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """

if (alter_res.size() == 0) {
return "FINISHED"
Expand Down Expand Up @@ -381,6 +379,8 @@ suite("test_show_data_multi_add", "p0") {
def testTableWithIndex = "test_show_data_httplogs_multi_add_with_index"
def delta_time = 5000
def timeout = 60000
def alter_res = "null"
def useTime = 0
String database = context.config.getDbNameByFile(context.file)

def create_httplogs_table_without_index = {testTablex ->
Expand Down Expand Up @@ -460,7 +460,6 @@ suite("test_show_data_multi_add", "p0") {
}

def wait_for_show_data_finish = { table_name, OpTimeout, origin_size ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def result = sql """show data from ${database}.${table_name};"""
if (result.size() > 0) {
Expand All @@ -478,9 +477,8 @@ suite("test_show_data_multi_add", "p0") {
}

def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
alter_res = alter_res.toString()
if(alter_res.contains("FINISHED")) {
sleep(3000) // wait change table state to normal
Expand All @@ -494,9 +492,8 @@ suite("test_show_data_multi_add", "p0") {
}

def wait_for_last_build_index_on_table_finish = { table_name, OpTimeout ->
def useTime = 0
for(int t = delta_time; t <= OpTimeout; t += delta_time){
def alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """
alter_res = sql """SHOW BUILD INDEX WHERE TableName = "${table_name}" ORDER BY JobId """

if (alter_res.size() == 0) {
return "FINISHED"
Expand Down
4 changes: 4 additions & 0 deletions regression-test/suites/nereids_p0/test_mv_select.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ suite("test_mv_select") {
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);"""

def timeout = 60000
def delta_time = 1000
def alter_res = "null"
def useTime = 0
def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
for(int t = delta_time; t <= OpTimeout; t += delta_time){
alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = "${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
Expand Down
5 changes: 3 additions & 2 deletions regression-test/suites/variant_p0/with_index/load.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ suite("regression_test_variant_with_index", "nonConcurrent"){
logger.info("update config: code=" + code + ", out=" + out + ", err=" + err)
}

def timeout = 60000
def delta_time = 1000
def alter_res = "null"
def useTime = 0
def wait_for_latest_op_on_table_finish = { tableName, OpTimeout ->
for(int t = delta_time; t <= OpTimeout; t += delta_time){
Expand Down Expand Up @@ -74,9 +76,8 @@ suite("regression_test_variant_with_index", "nonConcurrent"){
drop index idx
"""
logger.info("drop index " + "${table_name}" + "; result: " + drop_result)
def timeout = 60000
wait_for_latest_op_on_table_finish(table_name, timeout)
show_result = sql "show index from ${table_name}"
def show_result = sql "show index from ${table_name}"
assertEquals(show_result.size(), 0)
qt_sql_inv4 """select v["a1"] from ${table_name} where cast(v['a1'] as int) = 0"""
qt_sql_inv5 """select * from ${table_name} order by k"""
Expand Down

0 comments on commit 71c1a8f

Please sign in to comment.