From 582a9b9a3955109b770a9f7f0e2e97d131f95d77 Mon Sep 17 00:00:00 2001 From: zombee0 Date: Wed, 20 Nov 2024 20:08:58 +0800 Subject: [PATCH] [Enhancement]avoid Aws::Client::ClientConfiguration default ctor which has a remote access Signed-off-by: zombee0 --- be/src/fs/fs_s3.cpp | 2 +- be/test/fs/poco_http_client_test.cpp | 10 +++++----- be/test/io/s3_input_stream_test.cpp | 2 +- be/test/io/s3_output_stream_test.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/be/src/fs/fs_s3.cpp b/be/src/fs/fs_s3.cpp index 07ca45c7b58a80..dc4aefa89f6f0e 100644 --- a/be/src/fs/fs_s3.cpp +++ b/be/src/fs/fs_s3.cpp @@ -182,7 +182,7 @@ std::shared_ptr S3ClientFactory::_get_aws_cre if (!aws_cloud_credential.iam_role_arn.empty()) { // Do assume role - Aws::Client::ClientConfiguration clientConfiguration{}; + Aws::Client::ClientConfiguration clientConfiguration = S3ClientFactory::getClientConfig(); if (!aws_cloud_credential.sts_region.empty()) { clientConfiguration.region = aws_cloud_credential.sts_region; } diff --git a/be/test/fs/poco_http_client_test.cpp b/be/test/fs/poco_http_client_test.cpp index 522c62584990c9..f55009409cdfa0 100644 --- a/be/test/fs/poco_http_client_test.cpp +++ b/be/test/fs/poco_http_client_test.cpp @@ -79,7 +79,7 @@ void PocoHttpClientTest::TearDownTestCase() { } void PocoHttpClientTest::put_object(const std::string& object_content) { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig(); config.endpointOverride = config::object_storage_endpoint.empty() ? getenv("STARROCKS_UT_S3_ENDPOINT") : config::object_storage_endpoint; @@ -99,7 +99,7 @@ void PocoHttpClientTest::put_object(const std::string& object_content) { } TEST_F(PocoHttpClientTest, TestNormalAccess) { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig(); config.endpointOverride = config::object_storage_endpoint.empty() ? getenv("STARROCKS_UT_S3_ENDPOINT") : config::object_storage_endpoint; // Create a custom retry strategy @@ -123,7 +123,7 @@ TEST_F(PocoHttpClientTest, TestNormalAccess) { } TEST_F(PocoHttpClientTest, TestErrorEndpoint) { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig(); config.endpointOverride = "http://127.0.0.1"; // Create a custom retry strategy @@ -146,7 +146,7 @@ TEST_F(PocoHttpClientTest, TestErrorEndpoint) { } TEST_F(PocoHttpClientTest, TestErrorAkSk) { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig();; config.endpointOverride = config::object_storage_endpoint.empty() ? getenv("STARROCKS_UT_S3_ENDPOINT") : config::object_storage_endpoint; @@ -171,7 +171,7 @@ TEST_F(PocoHttpClientTest, TestErrorAkSk) { } TEST_F(PocoHttpClientTest, TestNotFoundKey) { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig();; config.endpointOverride = config::object_storage_endpoint.empty() ? getenv("STARROCKS_UT_S3_ENDPOINT") : config::object_storage_endpoint; // Create a custom retry strategy diff --git a/be/test/io/s3_input_stream_test.cpp b/be/test/io/s3_input_stream_test.cpp index 9a15ef3f2a6b5d..3cb5e1b7429c1e 100644 --- a/be/test/io/s3_input_stream_test.cpp +++ b/be/test/io/s3_input_stream_test.cpp @@ -79,7 +79,7 @@ void S3InputStreamTest::TearDownTestCase() { } void init_s3client() { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig(); config.endpointOverride = config::object_storage_endpoint.empty() ? getenv("STARROCKS_UT_S3_ENDPOINT") : config::object_storage_endpoint; const char* ak = config::object_storage_access_key_id.empty() ? getenv("STARROCKS_UT_S3_AK") diff --git a/be/test/io/s3_output_stream_test.cpp b/be/test/io/s3_output_stream_test.cpp index f619ca5763bdc8..b8745dfee923b7 100644 --- a/be/test/io/s3_output_stream_test.cpp +++ b/be/test/io/s3_output_stream_test.cpp @@ -66,7 +66,7 @@ void S3OutputStreamTest::TearDownTestCase() { } void init_s3client() { - Aws::Client::ClientConfiguration config; + Aws::Client::ClientConfiguration config = S3ClientFactory::getClientConfig(); config.endpointOverride = config::object_storage_endpoint; const char* ak = config::object_storage_access_key_id.c_str(); const char* sk = config::object_storage_secret_access_key.c_str();