Skip to content
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

Render smoke tests for services without support for account ID routing #3808

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

ysaito1001
Copy link
Contributor

@ysaito1001 ysaito1001 commented Aug 28, 2024

Motivation and Context

Follow-up on #3799

Description

This PR updates the smoke test rendering process for services whose models specify the smokeTests trait (example). Previously, SmokeTestsDecorator skipped rendering when useAccountIdRouting was set to true in the vendor parameters, which is the default for AwsVendorParams. Even though the Rust SDK does not currently support the account ID routing, it is safe to render these tests. This is because existing smoke tests do not rely on this feature, and when account ID routing is used, the Rust SDK will fall back to other means to sourcing the identity.

This PR includes a minor fix: it uses aws_config to load default configurations. config::Builder::new() would have no credentials provider chain available, which would then result in test failures at runtime.

---- test_list_certificates_success stdout ----
thread 'test_list_certificates_success' panicked at sdk/acm/tests/smoketests.rs:22:9:
request should succeed: DispatchFailure(DispatchFailure { source: ConnectorError { kind: Other(None), source: NoMatchingAuthSchemeError(ExploredList { items: [ExploredAuthOption { scheme_id: AuthSchemeId { scheme_id: "sigv4" }, result: NoIdentityResolver }], truncated: false }), connection: Unknown } })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

By bringing aws-config, the SmokeTestsDecoratorTest no longer works, since the AWS runtime crates required by aws-config conflict with those generated by awsSdkIntegrationTest (a known limitation). For example:

error: package collision in the lockfile: packages aws-credential-types v1.2.0 (smithy-rs/aws/rust-runtime/aws-credential-types) and aws-credential-types v1.2.0 (smithy-rs/aws/sdk/build/aws-sdk/sdk/aws-credential-types) are different, but only one can be written to lockfile unambiguously

Therefore, we removed SmokeTestsDecoratorTest.kt only in this PR to ship the feature, but are planning to restore it in the next PR by directly testing SmokeTestsInstantiator without using awsSdkIntegrationTest.

Testing

  • Existing tests in CI
  • Executed and passed smoke tests for services that support them in our release pipeline

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ysaito1001 ysaito1001 requested a review from a team as a code owner August 28, 2024 15:50
Copy link

@ysaito1001 ysaito1001 added this pull request to the merge queue Aug 28, 2024
Merged via the queue into main with commit 069ec70 Aug 28, 2024
44 checks passed
@ysaito1001 ysaito1001 deleted the ysaito/render-smoke-tests-without-acct-id-routing branch August 28, 2024 17:20
github-merge-queue bot pushed a commit that referenced this pull request Sep 4, 2024
## Motivation and Context
Restores `SmokeTestsDecoratorTest` that was temporarily removed in
#3808.

## Description
The said test was temporarily removed because `SmokeTestsDecorator` is
included in the [predefined
decorators](https://github.com/smithy-lang/smithy-rs/blob/b38ccb969e09ae0856c235fcb496b3f3faf41c87/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt#L35)
and pulls-in the `aws-config` crate for code generation. The issue was
conflicts between the runtime crates used by `aws-config` (located in
the `aws/sdk/build` directory) and those brought-in by that predefined
decorators used by `awsSdkIntegrationTest` (located in the
`rust-runtime` and `aws/rust-runtime` directories). This PR addresses
these conflicts and restores the test functionality.

Given the challenges, the code changes are centered around the following
ideas:
- Focus solely on testing the core class, `SmokeTestsInstantiator`. By
doing this, we avoid running `SmokeTestsDecorator`, which would
otherwise pull in the `aws-config` crate.
- Initializing a config builder in smoke tests needs to be parameterized
depending on the environment; in production we use
`aws_config::load_defaults` and in testing we avoid including
`aws-config` by using a default-constructed config builder, which is
sufficient for compile-only tests.
- The generated smoke tests in `SmokeTestsDecoratorTest` require minimal
runtime crates for compilation. We need the `CodegenVisitor` but with a
different set of codegen decorators. Prior to this PR,
`awsSdkIntegrationTest` used
[RustClientCodegenPlugin](https://github.com/smithy-lang/smithy-rs/blob/b38ccb969e09ae0856c235fcb496b3f3faf41c87/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/RustClientCodegenPlugin.kt#L46)
that in turn loaded [predefined
decorators](https://github.com/smithy-lang/smithy-rs/blob/b38ccb969e09ae0856c235fcb496b3f3faf41c87/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt#L35)
on the classpath, which included `SmokeTestsDecorator`. In this PR, we
work around this by defining a minimal set of codegen decorators and
making them pluggable through `awsSdkIntegrationTest`.

## Testing
Tests in CI

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants