Skip to content

Commit

Permalink
[Enhance](regression)enhance case test_broker_load_func (apache#26118)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangguoqiang666 authored Oct 31, 2023
1 parent 2c4fa2d commit b87b09b
Showing 1 changed file with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand All @@ -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 {
}
Expand Down

0 comments on commit b87b09b

Please sign in to comment.