Skip to content

Commit e2bfd35

Browse files
authored
Adjust no_auth test expectation to address semver hazards failure (#4211)
## Motivation and Context This PR is a prerequisite for #4203. # Details PR4203 has updated some of the `AuthSchemeId` string values, which causes the `no_auth` test to fail in the semver hazards check. This happens because the inner string value for `NO_AUTH_SCHEME_ID` has been modified from `no_auth` to `noAuth`. To resolve this, this PR updates the test expectation so that it no longer depends on raw string values. Once this PR is merged and released from `aws-sdk-rust`, PR4203 should pass the semver hazards check successfully. Also the test has been moved to `no_auth.rs` since it is not specific to S3 Express; it was originally placed in `express.rs` because the issue was first discovered while investigating S3 Express behavior. ---- _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 1799955 commit e2bfd35

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -453,28 +453,3 @@ async fn s3_express_auth_flow_should_not_be_reached_with_no_auth_schemes() {
453453
// If s3 Express auth flow were exercised, no request would be received, most likely due to `TimeoutError`.
454454
let _ = request.expect_request();
455455
}
456-
457-
#[tracing_test::traced_test]
458-
#[tokio::test]
459-
async fn no_auth_should_be_selected_when_no_credentials_is_configured() {
460-
let (http_client, _) = capture_request(None);
461-
let config = aws_config::from_env()
462-
.http_client(http_client)
463-
.region(Region::new("us-east-2"))
464-
.no_credentials()
465-
.load()
466-
.await;
467-
468-
let client = Client::new(&config);
469-
let _ = dbg!(
470-
client
471-
.list_objects_v2()
472-
.bucket("doesnotmatter")
473-
.send()
474-
.await
475-
);
476-
477-
assert!(logs_contain(
478-
"resolving identity scheme_id=AuthSchemeId { scheme_id: \"no_auth\" }"
479-
));
480-
}

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

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

6+
use aws_sdk_s3::config::Region;
67
use aws_sdk_s3::{Client, Config};
8+
use aws_smithy_http_client::test_util::capture_request;
79
use aws_smithy_http_client::test_util::dvr::ReplayingClient;
10+
use aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID;
811
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
912

1013
#[tokio::test]
@@ -131,3 +134,29 @@ async fn get_object() {
131134
.await
132135
.unwrap();
133136
}
137+
138+
#[tracing_test::traced_test]
139+
#[tokio::test]
140+
async fn no_auth_should_be_selected_when_no_credentials_is_configured() {
141+
let (http_client, _) = capture_request(None);
142+
let config = aws_config::from_env()
143+
.http_client(http_client)
144+
.region(Region::new("us-east-2"))
145+
.no_credentials()
146+
.load()
147+
.await;
148+
149+
let client = Client::new(&config);
150+
let _ = dbg!(
151+
client
152+
.list_objects_v2()
153+
.bucket("doesnotmatter")
154+
.send()
155+
.await
156+
);
157+
158+
assert!(logs_contain(&format!(
159+
"resolving identity scheme_id=AuthSchemeId {{ scheme_id: \"{auth_scheme_id_str}\" }}",
160+
auth_scheme_id_str = NO_AUTH_SCHEME_ID.inner(),
161+
)));
162+
}

0 commit comments

Comments
 (0)