Skip to content

Commit

Permalink
[Enhancement]avoid Aws::Client::ClientConfiguration default ctor whic…
Browse files Browse the repository at this point in the history
…h has a remote access

Signed-off-by: zombee0 <[email protected]>
  • Loading branch information
zombee0 committed Nov 20, 2024
1 parent c38a677 commit 582a9b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion be/src/fs/fs_s3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ std::shared_ptr<Aws::Auth::AWSCredentialsProvider> 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;
}
Expand Down
10 changes: 5 additions & 5 deletions be/test/fs/poco_http_client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/s3_input_stream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion be/test/io/s3_output_stream_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 582a9b9

Please sign in to comment.