-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: tests to ensure all interceptors are run if an error occurs in one #2664
Conversation
add: stub components for orchestrator testing
A new generated diff is ready to view.
A new doc preview is ready to view. |
You can write |
I actually don't want to close that issue since I still have more work to do. This PR adds tests that check error handling flow for individual hooks. I'm going to create another PR that tests the behavior across multiple hooks, since most (IIRC) times we're still supposed to run the This PR was already getting a bit long and that's why I'm splitting the work up. I also wanted to make sure that I'm in-sync with John and the work he's doing. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
I'm waiting on the changes introduced by #2670 Once those make it to |
remove: trace probe
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct AnonymousAuthScheme { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bunch of anonymous auth scheme stuff in crate::client::identity
already. I think it belongs outside of test utils since it is a legitimate use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a runtime plugin for anonymous auth that uses the pre-existing stuff. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the use of the interceptor_error_handling_test
macro to simplify each test call site!
…eptor test add: runtime plugin for anonymous auth fix: clippy lints for explicit lifetimes remove: test-utils endpoints and auth modules
fn resolve_auth_options<'a>( | ||
&'a self, | ||
fn resolve_auth_options( | ||
&self, | ||
params: &AuthOptionResolverParams, | ||
) -> Result<Cow<'a, [AuthSchemeId]>, BoxError>; | ||
) -> Result<Cow<'_, [AuthSchemeId]>, BoxError>; | ||
} | ||
|
||
impl AuthOptionResolver for Box<dyn AuthOptionResolver> { | ||
fn resolve_auth_options<'a>( | ||
&'a self, | ||
fn resolve_auth_options( | ||
&self, | ||
params: &AuthOptionResolverParams, | ||
) -> Result<Cow<'a, [AuthSchemeId]>, BoxError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter was complaining about an unnecessary explicit lifetime here and in the auth option resolver so I switched it to an anonymous lifetime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I take it to mean that the compiler deterministically derives the anomalous lifeitme in this case from the first &
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what happens AFAICT
@@ -12,6 +12,7 @@ repository = "https://github.com/awslabs/smithy-rs" | |||
[features] | |||
default = [] | |||
http-auth = ["dep:zeroize"] | |||
anonymous-auth = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the anonymous auth stuff was always available. I added some more stuff related to anonymous auth and feature-gated it since we were already doing so for http-auth
.
@@ -65,30 +68,6 @@ impl Identity { | |||
} | |||
} | |||
|
|||
#[derive(Debug)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to aws_smithy_runtime_api::client::identity::anonymous
A new generated diff is ready to view.
A new doc preview is ready to view. |
fn resolve_auth_options<'a>( | ||
&'a self, | ||
fn resolve_auth_options( | ||
&self, | ||
params: &AuthOptionResolverParams, | ||
) -> Result<Cow<'a, [AuthSchemeId]>, BoxError>; | ||
) -> Result<Cow<'_, [AuthSchemeId]>, BoxError>; | ||
} | ||
|
||
impl AuthOptionResolver for Box<dyn AuthOptionResolver> { | ||
fn resolve_auth_options<'a>( | ||
&'a self, | ||
fn resolve_auth_options( | ||
&self, | ||
params: &AuthOptionResolverParams, | ||
) -> Result<Cow<'a, [AuthSchemeId]>, BoxError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I take it to mean that the compiler deterministically derives the anomalous lifeitme in this case from the first &
.
rust-runtime/aws-smithy-runtime-api/src/client/runtime_plugin/anonymous_auth.rs
Outdated
Show resolved
Hide resolved
A new generated diff is ready to view.
A new doc preview is ready to view. |
…ne (#2664) ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> #2662 ## Description <!--- Describe your changes in detail --> This PR adds tests for all interceptor hooks to ensure the correct error handling behavior and defines a set of stub components for orchestrator testing. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> This PR includes tests. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
…ne (#2664) ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> #2662 ## Description <!--- Describe your changes in detail --> This PR adds tests for all interceptor hooks to ensure the correct error handling behavior and defines a set of stub components for orchestrator testing. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> This PR includes tests. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
…ne (#2664) ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> #2662 ## Description <!--- Describe your changes in detail --> This PR adds tests for all interceptor hooks to ensure the correct error handling behavior and defines a set of stub components for orchestrator testing. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> This PR includes tests. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Motivation and Context
#2662
Description
This PR adds tests for all interceptor hooks to ensure the correct error handling behavior and defines a set of stub components for orchestrator testing.
Testing
This PR includes tests.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.