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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import software.amazon.smithy.rust.codegen.core.rustlang.docs
import software.amazon.smithy.rust.codegen.core.rustlang.rust
import software.amazon.smithy.rust.codegen.core.rustlang.rustBlock
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.PublicImportSymbolProvider
import software.amazon.smithy.rust.codegen.core.smithy.RustCrate
import software.amazon.smithy.rust.codegen.core.smithy.generators.BuilderGenerator
import software.amazon.smithy.rust.codegen.core.smithy.generators.Instantiator
Expand Down Expand Up @@ -50,12 +51,6 @@ class SmokeTestsDecorator : ClientCodegenDecorator {
logger.warning("skipping smoketest `${smokeTestCase.id}` with unsupported vendorParam `sigv4aRegionSet`")
return false
}
// TODO(https://github.com/smithy-lang/smithy-rs/issues/3776) Once Account ID routing is supported,
// update the vendorParams setter and remove this check.
if (vendorParams.useAccountIdRouting()) {
logger.warning("skipping smoketest `${smokeTestCase.id}` with unsupported vendorParam `useAccountIdRouting`")
return false
}
}
AwsSmokeTestModel.getS3VendorParams(smokeTestCase)?.orNull()?.let { s3VendorParams ->
if (s3VendorParams.useGlobalEndpoint()) {
Expand Down Expand Up @@ -138,7 +133,7 @@ class SmokeTestsBuilderKindBehavior(val codegenContext: CodegenContext) : Instan
}

class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : Instantiator(
codegenContext.symbolProvider,
PublicImportSymbolProvider(codegenContext.symbolProvider, codegenContext.moduleUseName()),
codegenContext.model,
codegenContext.runtimeConfig,
SmokeTestsBuilderKindBehavior(codegenContext),
Expand All @@ -147,9 +142,16 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) :
writer: RustWriter,
testCase: SmokeTestCase,
) {
writer.rust("let conf = config::Builder::new()")
writer.rust(
"let config = #{T}::load_defaults(config::BehaviorVersion::latest()).await;",
AwsCargoDependency.awsConfig(codegenContext.runtimeConfig).toType(),
)
writer.rust("let conf = config::Config::from(&config).to_builder()")
writer.indent()
writer.rust(".behavior_version(config::BehaviorVersion::latest())")

// TODO(https://github.com/smithy-lang/smithy-rs/issues/3776) Once Account ID routing is supported,
// reflect the config setting here, especially to disable it if needed, as it is enabled by default in
// `AwsVendorParams`.

val vendorParams = AwsSmokeTestModel.getAwsVendorParams(testCase)
vendorParams.orNull()?.let { params ->
Expand Down

This file was deleted.