Skip to content

Commit 8ba6b6d

Browse files
authored
Avoid using default provider chain in tests (#4229)
## Motivation and Context The previous tests mistakenly used the default credentials provider chain, which led to test failures during a release. This occurred because the chain hit a credentials provider that made a remote call (e.g., IMDS), causing the captured request to be exhausted, leading to a panic. To address this issue, the PR avoids using the default credentials provider chain. ## Testing ~Currently verifying in the release pipeline~ Verified ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
1 parent d1db8ba commit 8ba6b6d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

aws/sdk/integration-tests/s3/tests/auth_scheme_preference.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
use aws_config::Region;
6+
use aws_sdk_s3::config::Region;
77
use aws_sdk_s3::{Client, Config};
88
use aws_smithy_http_client::test_util::capture_request;
99

@@ -14,16 +14,15 @@ use aws_smithy_http_client::test_util::capture_request;
1414
#[tokio::test]
1515
async fn auth_scheme_preference_at_client_level_should_take_the_highest_priority() {
1616
let (http_client, _) = capture_request(None);
17-
let config = aws_config::from_env()
17+
let conf = Config::builder()
1818
.http_client(http_client)
1919
.region(Region::new("us-east-2"))
20+
.with_test_defaults()
2021
// Explicitly set a preference that favors `sigv4`, otherwise `sigv4a`
2122
// would normally be resolved based on the endpoint authSchemes property.
2223
.auth_scheme_preference([aws_runtime::auth::sigv4::SCHEME_ID])
23-
.load()
24-
.await;
25-
26-
let client = Client::new(&config);
24+
.build();
25+
let client = Client::from_conf(conf);
2726
let _ = client
2827
.get_object()
2928
.bucket("arn:aws:s3::123456789012:accesspoint/mfzwi23gnjvgw.mrap")
@@ -41,13 +40,12 @@ async fn auth_scheme_preference_at_client_level_should_take_the_highest_priority
4140
#[tokio::test]
4241
async fn auth_scheme_preference_at_operation_level_should_take_the_highest_priority() {
4342
let (http_client, _) = capture_request(None);
44-
let config = aws_config::from_env()
43+
let conf = Config::builder()
4544
.http_client(http_client)
4645
.region(Region::new("us-east-2"))
47-
.load()
48-
.await;
49-
50-
let client = Client::new(&config);
46+
.with_test_defaults()
47+
.build();
48+
let client = Client::from_conf(conf);
5149
let _ = client
5250
.get_object()
5351
.bucket("arn:aws:s3::123456789012:accesspoint/mfzwi23gnjvgw.mrap")

0 commit comments

Comments
 (0)