From b87b09bb049a91d031873a56355307ddd0a1d6fb Mon Sep 17 00:00:00 2001 From: zhangguoqiang <18372634969@163.com> Date: Tue, 31 Oct 2023 19:22:25 +0800 Subject: [PATCH] [Enhance](regression)enhance case test_broker_load_func (#26118) --- .../broker_load/test_broker_load_func.groovy | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/regression-test/suites/external_table_p0/broker_load/test_broker_load_func.groovy b/regression-test/suites/external_table_p0/broker_load/test_broker_load_func.groovy index c3793c605a2285..e15579a7ae9593 100644 --- a/regression-test/suites/external_table_p0/broker_load/test_broker_load_func.groovy +++ b/regression-test/suites/external_table_p0/broker_load/test_broker_load_func.groovy @@ -25,13 +25,16 @@ suite("test_broker_load_func", "p0,external,hive,external_docker,external_docker String database_name = "test_broker_load_func" String broker_name = "hdfs" + def uuid = UUID.randomUUID().toString().replaceAll("-", "") + def test_load_label="label_test_broker_load_func_${uuid}" + String table_name="simple" sql """drop database if exists ${database_name}; """ sql """create database if not exists ${database_name};""" sql """use ${database_name}; """ sql """ - create table simple ( + create table ${table_name} ( `t_empty_string` varchar(255) NULL COMMENT '', `t_string` varchar(255) NULL COMMENT '' ) engine=olap @@ -42,10 +45,10 @@ suite("test_broker_load_func", "p0,external,hive,external_docker,external_docker """ sql """ - LOAD LABEL ${database_name}.label_test_broker_load_func + LOAD LABEL ${database_name}.${test_load_label} ( DATA INFILE("hdfs://${externalEnvIp}:${hdfsPort}/user/doris/preinstalled_data/csv/csv_all_types/csv_all_types") - INTO TABLE `simple` + INTO TABLE ${table_name} COLUMNS TERMINATED BY "," ) WITH BROKER ${broker_name} @@ -55,11 +58,26 @@ suite("test_broker_load_func", "p0,external,hive,external_docker,external_docker ); """ - sleep(10000) - - def res = sql """select count(*) from simple;""" - - assertEquals(10,res[0][0]) + def check_load_result = {checklabel, testTablex -> + max_try_milli_secs = 60000 + while(max_try_milli_secs) { + result = sql "show load where label = '${checklabel}'" + if(result[0][2] == "FINISHED") { + //sql "sync" + def res = sql "select count(*) from ${database_name}.${testTablex};" + assertEquals(10,res[0][0]) + break + } else { + sleep(1000) // wait 1 second every time + max_try_milli_secs -= 1000 + if(max_try_milli_secs <= 0) { + assertEquals(1, 2) + } + } + } + } + + check_load_result.call(test_load_label, table_name) } finally { }