Skip to content

Commit

Permalink
[fix](workflow) Fix failure test cases in BE UT (macOS) (#26425)
Browse files Browse the repository at this point in the history
1. Fix memory issues in LoadStreamMgrTest.
2. Skip S3FileWriterTest by default because it depends on the environment in teamcity.
3. Fix VTimestampFunctionsTest.convert_tz_test.
  • Loading branch information
adonis0147 authored Nov 6, 2023
1 parent f226117 commit 1e2a614
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
15 changes: 14 additions & 1 deletion be/test/io/fs/s3_file_writer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ static std::shared_ptr<io::S3FileSystem> s3_fs {nullptr};
class S3FileWriterTest : public testing::Test {
public:
static void SetUpTestSuite() {
if (getenv(RUN_S3_TESTS) == nullptr || std::string {getenv(RUN_S3_TESTS)} != "true") {
GTEST_SKIP();
}
S3Conf s3_conf;
config::enable_debug_points = true;
DebugPoints::instance()->clear();
Expand Down Expand Up @@ -73,13 +76,23 @@ class S3FileWriterTest : public testing::Test {
}

static void TearDownTestSuite() {
if (getenv(RUN_S3_TESTS) == nullptr || std::string {getenv(RUN_S3_TESTS)} != "true") {
GTEST_SKIP();
}
ExecEnv::GetInstance()->_s3_file_upload_thread_pool->shutdown();
ExecEnv::GetInstance()->_s3_file_upload_thread_pool = nullptr;
delete ExecEnv::GetInstance()->_s3_buffer_pool;
ExecEnv::GetInstance()->_s3_buffer_pool = nullptr;
}

void SetUp() override {
if (getenv(RUN_S3_TESTS) == nullptr || std::string {getenv(RUN_S3_TESTS)} != "true") {
GTEST_SKIP();
}
}

private:
static constexpr char RUN_S3_TESTS[] = "RUN_S3_TESTS";
};

TEST_F(S3FileWriterTest, multi_part_io_error) {
Expand Down Expand Up @@ -476,4 +489,4 @@ TEST_F(S3FileWriterTest, multi_part_complete_error_3) {
}
}

} // namespace doris
} // namespace doris
5 changes: 2 additions & 3 deletions be/test/runtime/load_stream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,11 @@ class LoadStreamMgrTest : public testing::Test {
}

void TearDown() override {
ExecEnv::GetInstance()->set_storage_engine(nullptr);
k_engine.reset();
_server->Stop(1000);
_load_stream_mgr.reset();
CHECK_EQ(0, _server->Join());
SAFE_DELETE(_server);
k_engine.reset();
doris::ExecEnv::GetInstance()->set_storage_engine(nullptr);
}

std::string read_data(int64_t txn_id, int64_t partition_id, int64_t tablet_id, uint32_t segid) {
Expand Down
25 changes: 17 additions & 8 deletions be/test/vec/function/function_time_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ TEST(VTimestampFunctionsTest, convert_tz_test) {

InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::String, TypeIndex::String};

{
bool case_sensitive = true;
cctz::time_zone tz {};
if (TimezoneUtils::find_cctz_time_zone("Asia/SHANGHAI", tz)) {
case_sensitive = false;
}

if (case_sensitive) {
DataSet data_set = {{{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/SHANGHAI"},
std::string {"america/Los_angeles"}},
Null()}};
Expand All @@ -221,15 +227,18 @@ TEST(VTimestampFunctionsTest, convert_tz_test) {
DataSet data_set = {{{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/Shanghai"},
std::string {"UTC"}},
str_to_datetime_v2("2019-07-31 18:18:27", "%Y-%m-%d %H:%i:%s.%f")},
{{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/Shanghai"},
std::string {"Utc"}},
Null()},
{{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/Shanghai"},
std::string {"UTC"}},
str_to_datetime_v2("2019-07-31 18:18:27", "%Y-%m-%d %H:%i:%s.%f")},
{{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/SHANGHAI"},
std::string {"america/Los_angeles"}},
Null()}};
str_to_datetime_v2("2019-07-31 18:18:27", "%Y-%m-%d %H:%i:%s.%f")}};
if (case_sensitive) {
data_set.push_back(Row {{std::string {"2019-08-01 02:18:27"},
std::string {"Asia/Shanghai"}, std::string {"Utc"}},
Null()});
data_set.push_back(
Row {{std::string {"2019-08-01 02:18:27"}, std::string {"Asia/SHANGHAI"},
std::string {"america/Los_angeles"}},
Null()});
}
static_cast<void>(
check_function<DataTypeDateTimeV2, true>(func_name, input_types, data_set, false));
}
Expand Down

0 comments on commit 1e2a614

Please sign in to comment.