From e65dd73376b05e4a9d9b51ba63c22e086dc304f5 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Fri, 12 Jul 2024 13:05:08 -0500 Subject: [PATCH 1/9] add codegen for smoke tests --- aws/sdk-codegen/build.gradle.kts | 2 + .../smithy/rustsdk/AwsCodegenDecorator.kt | 1 + .../smithy/rustsdk/SmokeTestsDecorator.kt | 167 ++++++++++++++++++ codegen-client/build.gradle.kts | 2 +- .../generators/OperationCustomization.kt | 8 + .../smithy/generators/OperationGenerator.kt | 6 + .../generators/OperationUnitTestGenerator.kt | 45 +++++ 7 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt create mode 100644 codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt diff --git a/aws/sdk-codegen/build.gradle.kts b/aws/sdk-codegen/build.gradle.kts index 37fe30af79..18b18a69a8 100644 --- a/aws/sdk-codegen/build.gradle.kts +++ b/aws/sdk-codegen/build.gradle.kts @@ -27,6 +27,8 @@ dependencies { implementation("software.amazon.smithy:smithy-protocol-test-traits:$smithyVersion") implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion") implementation("software.amazon.smithy:smithy-aws-endpoints:$smithyVersion") + implementation("software.amazon.smithy:smithy-smoke-test-traits:$smithyVersion") + implementation("software.amazon.smithy:smithy-aws-smoke-test-model:$smithyVersion") } java { diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt index 2c9bf01133..d665c5404b 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsCodegenDecorator.kt @@ -63,6 +63,7 @@ val DECORATORS: List = TokenProvidersDecorator(), ServiceEnvConfigDecorator(), HttpRequestCompressionDecorator(), + SmokeTestsDecorator(), ), // S3 needs `AwsErrorCodeClassifier` to handle an `InternalError` as a transient error. We need to customize // that behavior for S3 in a way that does not conflict with the globally applied `RetryClassifierDecorator`. diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt new file mode 100644 index 0000000000..9c57290be0 --- /dev/null +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -0,0 +1,167 @@ +package software.amazon.smithy.rustsdk + +import software.amazon.smithy.model.node.ObjectNode +import software.amazon.smithy.model.shapes.MemberShape +import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.model.shapes.StructureShape +import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext +import software.amazon.smithy.rust.codegen.client.smithy.customize.ClientCodegenDecorator +import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationCustomization +import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationSection +import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator +import software.amazon.smithy.rust.codegen.core.rustlang.Attribute +import software.amazon.smithy.rust.codegen.core.rustlang.Attribute.Companion.cfg +import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter +import software.amazon.smithy.rust.codegen.core.rustlang.Writable +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.rustlang.writable +import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext +import software.amazon.smithy.rust.codegen.core.smithy.generators.BuilderGenerator +import software.amazon.smithy.rust.codegen.core.smithy.generators.Instantiator +import software.amazon.smithy.rust.codegen.core.smithy.generators.setterName +import software.amazon.smithy.rust.codegen.core.util.dq +import software.amazon.smithy.rust.codegen.core.util.expectTrait +import software.amazon.smithy.rust.codegen.core.util.inputShape +import software.amazon.smithy.rust.codegen.core.util.letIf +import software.amazon.smithy.rust.codegen.core.util.orNull +import software.amazon.smithy.rust.codegen.core.util.toSnakeCase +import software.amazon.smithy.smoketests.traits.Expectation +import software.amazon.smithy.smoketests.traits.SmokeTestCase +import software.amazon.smithy.smoketests.traits.SmokeTestsTrait +import java.util.Optional + +class SmokeTestsDecorator : ClientCodegenDecorator { + override val name: String = "SmokeTests" + override val order: Byte = 0 + + override fun operationCustomizations( + codegenContext: ClientCodegenContext, + operation: OperationShape, + baseCustomizations: List, + ): List = + baseCustomizations.letIf(operation.hasTrait(SmokeTestsTrait.ID)) { + it + SmokeTestsOperationCustomization(codegenContext, operation) + } +} + +class SmokeTestsOperationCustomization( + private val codegenContext: ClientCodegenContext, + private val operation: OperationShape, +) : OperationCustomization() { + private val smokeTestsTrait = operation.expectTrait() + private val testCases: List = smokeTestsTrait.testCases + private val operationInput = operation.inputShape(codegenContext.model) + + override fun section(section: OperationSection): Writable { + if (testCases.isEmpty()) return emptySection + + return when (section) { + is OperationSection.UnitTests -> + writable { + testCases.forEach { testCase -> + Attribute(cfg("smokeTests")).render(this) + Attribute.TokioTest.render(this) + this.rustBlock("async fn test_${testCase.id.toSnakeCase()}()") { + val instantiator = SmokeTestsInstantiator(codegenContext) + instantiator.renderConf(this, testCase.vendorParams) + rust("let client = crate::Client::from_conf(conf);") + instantiator.renderInput(this, operation, operationInput, testCase.params) + instantiator.renderExpectation(this, testCase.expectation) + } + } + } + + else -> emptySection + } + } +} + +class SmokeTestsBuilderKindBehavior(val codegenContext: CodegenContext) : Instantiator.BuilderKindBehavior { + override fun hasFallibleBuilder(shape: StructureShape): Boolean = + BuilderGenerator.hasFallibleBuilder(shape, codegenContext.symbolProvider) + + override fun setterName(memberShape: MemberShape): String = memberShape.setterName() + + override fun doesSetterTakeInOption(memberShape: MemberShape): Boolean = true +} + +class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : Instantiator( + codegenContext.symbolProvider, + codegenContext.model, + codegenContext.runtimeConfig, + SmokeTestsBuilderKindBehavior(codegenContext), +) { + fun renderConf( + writer: RustWriter, + data: Optional, + ) { + writer.rust("let conf = crate::config::Builder::new()") + writer.indent() + writer.rust(".behavior_version(crate::config::BehaviorVersion::latest())") + data.orNull()?.let { node -> + val region = node.getStringMemberOrDefault("region", "us-west-2") +// val sigv4aRegionSet = node.getArrayMember("sigv4aRegionSet") +// .map { a -> +// a.getElementsAs { el -> +// el.expectStringNode().getValue() +// } +// } +// .orElse(null) +// val useAccountIdRouting = node.getBooleanMemberOrDefault("useAccountIdRouting", true) + val useDualstack = node.getBooleanMemberOrDefault("useDualstack", false) + val useFips = node.getBooleanMemberOrDefault("useFips", false) + val uri = node.getStringMemberOrDefault("uri", null) + val useAccelerate = node.getBooleanMemberOrDefault("useAccelerate", false) +// val useGlobalEndpoint = node.getBooleanMemberOrDefault("useGlobalEndpoint", false) + val forcePathStyle = node.getBooleanMemberOrDefault("forcePathStyle", false) + val useArnRegion = node.getBooleanMemberOrDefault("useArnRegion", true) + val useMultiRegionAccessPoints = node.getBooleanMemberOrDefault("useMultiRegionAccessPoints", true) + + region?.let { writer.rust(".region(crate::config::Region::new(${it.dq()}))") } +// sigv4aRegionSet?.let { writer.rust("._($it)") } +// useAccountIdRouting?.let { writer.rust("._($it)") } + useDualstack?.let { writer.rust(".use_dual_stack($it)") } + useFips?.let { writer.rust(".use_fips($it)") } + uri?.let { writer.rust(".endpoint_url($it)") } + useAccelerate?.let { writer.rust(".accelerate_($it)") } +// useGlobalEndpoint?.let { writer.rust(".use_global_endpoint_($it)")} + forcePathStyle?.let { writer.rust(".force_path_style_($it)") } + useArnRegion?.let { writer.rust(".use_arn_region($it)") } + useMultiRegionAccessPoints?.let { writer.rust(".disable_multi_region_access_points(!$it)") } + } + writer.rust(".build();") + writer.dedent() + } + + fun renderInput( + writer: RustWriter, + operationShape: OperationShape, + inputShape: StructureShape, + data: Optional, + headers: Map = mapOf(), + ctx: Ctx = Ctx(), + ) { + val operationBuilderName = + FluentClientGenerator.clientOperationFnName(operationShape, codegenContext.symbolProvider) + + writer.rust("let res = client.$operationBuilderName()") + writer.indent() + data.orNull()?.let { + renderStructureMembers(writer, inputShape, it, headers, ctx) + } + writer.rust(".send().await;") + writer.dedent() + } + + fun renderExpectation( + writer: RustWriter, + expectation: Expectation, + ) { + if (expectation.isSuccess) { + writer.rust("""res.expect("request should succeed");""") + } else if (expectation.isFailure) { + writer.rust("""res.expect_err("request should fail");""") + } + } +} diff --git a/codegen-client/build.gradle.kts b/codegen-client/build.gradle.kts index 485a656d7b..2214d50785 100644 --- a/codegen-client/build.gradle.kts +++ b/codegen-client/build.gradle.kts @@ -29,7 +29,7 @@ dependencies { implementation("software.amazon.smithy:smithy-rules-engine:$smithyVersion") // `smithy.framework#ValidationException` is defined here, which is used in event stream -// marshalling/unmarshalling tests. + // marshalling/unmarshalling tests. testImplementation("software.amazon.smithy:smithy-validation-model:$smithyVersion") } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt index 07ed4e51cb..0017519a93 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt @@ -125,6 +125,14 @@ sealed class OperationSection(name: String) : Section(name) { writer.rustTemplate(".with_retry_classifier(#{classifier})", "classifier" to classifier) } } + + /** + * Hook to add unit tests for an operation. + */ + data class UnitTests( + override val customizations: List, + val operationShape: OperationShape, + ) : OperationSection("UnitTests") } abstract class OperationCustomization : NamedCustomization() diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt index c2200003db..9a617d62b8 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt @@ -211,5 +211,11 @@ open class OperationGenerator( EndpointParamsInterceptorGenerator(codegenContext) .render(operationWriter, operationShape) + + OperationUnitTestGenerator(codegenContext).render( + operationWriter, + operationShape, + operationCustomizations, + ) } } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt new file mode 100644 index 0000000000..93316d2a6f --- /dev/null +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt @@ -0,0 +1,45 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rust.codegen.client.smithy.generators + +import software.amazon.smithy.model.shapes.OperationShape +import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext +import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter +import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate +import software.amazon.smithy.rust.codegen.core.rustlang.writable +import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType.Companion.preludeScope +import software.amazon.smithy.rust.codegen.core.smithy.customize.writeCustomizations + +/** + * Generates operation-level unit tests + */ +class OperationUnitTestGenerator( + private val codegenContext: ClientCodegenContext, +) { + fun render( + writer: RustWriter, + operationShape: OperationShape, + customizations: List, + ) { + // TODO don't generate this if there are no customizations adding unit tests. + writer.rustTemplate( + """ + ##[cfg(test)] + mod test { + #{unit_tests} + } + """, + *preludeScope, + "unit_tests" to + writable { + writeCustomizations( + customizations, + OperationSection.UnitTests(customizations, operationShape), + ) + }, + ) + } +} From 7d3cbb2942b7f977ac31de15a567a9e48c8a9ab3 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Fri, 12 Jul 2024 15:22:26 -0500 Subject: [PATCH 2/9] add TODO context add missing copyright header --- .../software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt | 5 +++++ .../client/smithy/generators/OperationUnitTestGenerator.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index 9c57290be0..1c9d6deb26 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -1,3 +1,8 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + package software.amazon.smithy.rustsdk import software.amazon.smithy.model.node.ObjectNode diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt index 93316d2a6f..c0e12f71ee 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt @@ -24,7 +24,7 @@ class OperationUnitTestGenerator( operationShape: OperationShape, customizations: List, ) { - // TODO don't generate this if there are no customizations adding unit tests. + // TODO(smithy-rs#3759) don't generate this if there are no customizations adding unit tests. writer.rustTemplate( """ ##[cfg(test)] From 83b927a103170d862b4da6cacc7eb88e9c842914 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Mon, 15 Jul 2024 09:41:20 -0500 Subject: [PATCH 3/9] update service check action to support running smoketests update smoketest config flag --- .../amazon/smithy/rustsdk/SmokeTestsDecorator.kt | 2 +- tools/ci-scripts/check-aws-sdk-services | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index 1c9d6deb26..5fef23c161 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -65,7 +65,7 @@ class SmokeTestsOperationCustomization( is OperationSection.UnitTests -> writable { testCases.forEach { testCase -> - Attribute(cfg("smokeTests")).render(this) + Attribute(cfg("v2SmokeTests")).render(this) Attribute.TokioTest.render(this) this.rustBlock("async fn test_${testCase.id.toSnakeCase()}()") { val instantiator = SmokeTestsInstantiator(codegenContext) diff --git a/tools/ci-scripts/check-aws-sdk-services b/tools/ci-scripts/check-aws-sdk-services index 2c86e975e8..c6b13d4c62 100755 --- a/tools/ci-scripts/check-aws-sdk-services +++ b/tools/ci-scripts/check-aws-sdk-services @@ -7,9 +7,16 @@ set -eux cd aws-sdk +# Check if the VERBOSE environment variable is set +if [ -n "$ENABLE_V2_SMOKETESTS" ]; then + RUN_V2_SMOKETESTS="--cfg v2SmokeTests" +else + RUN_V2_SMOKETESTS="" +fi + # Invoking `cargo test` at the root directory implicitly checks for the validity # of the top-level `Cargo.toml` -cargo test --all-features +cargo test --all-features -- "$RUN_V2_SMOKETESTS" for test_dir in tests/*; do if [ -f "${test_dir}/Cargo.toml" ]; then From fa8e4bb188dc132e1df52910c403204acc215e1c Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Tue, 23 Jul 2024 14:13:19 -0500 Subject: [PATCH 4/9] use smithy to parse smokeTest vendorParams --- .../smithy/rustsdk/SmokeTestsDecorator.kt | 54 ++++++++----------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index 5fef23c161..2e1ed14729 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -5,6 +5,7 @@ package software.amazon.smithy.rustsdk +import software.amazon.smithy.aws.smoketests.model.AwsSmokeTestModel import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.model.shapes.OperationShape @@ -69,7 +70,7 @@ class SmokeTestsOperationCustomization( Attribute.TokioTest.render(this) this.rustBlock("async fn test_${testCase.id.toSnakeCase()}()") { val instantiator = SmokeTestsInstantiator(codegenContext) - instantiator.renderConf(this, testCase.vendorParams) + instantiator.renderConf(this, testCase) rust("let client = crate::Client::from_conf(conf);") instantiator.renderInput(this, operation, operationInput, testCase.params) instantiator.renderExpectation(this, testCase.expectation) @@ -99,42 +100,31 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : ) { fun renderConf( writer: RustWriter, - data: Optional, + testCase: SmokeTestCase, ) { writer.rust("let conf = crate::config::Builder::new()") writer.indent() writer.rust(".behavior_version(crate::config::BehaviorVersion::latest())") - data.orNull()?.let { node -> - val region = node.getStringMemberOrDefault("region", "us-west-2") -// val sigv4aRegionSet = node.getArrayMember("sigv4aRegionSet") -// .map { a -> -// a.getElementsAs { el -> -// el.expectStringNode().getValue() -// } -// } -// .orElse(null) -// val useAccountIdRouting = node.getBooleanMemberOrDefault("useAccountIdRouting", true) - val useDualstack = node.getBooleanMemberOrDefault("useDualstack", false) - val useFips = node.getBooleanMemberOrDefault("useFips", false) - val uri = node.getStringMemberOrDefault("uri", null) - val useAccelerate = node.getBooleanMemberOrDefault("useAccelerate", false) -// val useGlobalEndpoint = node.getBooleanMemberOrDefault("useGlobalEndpoint", false) - val forcePathStyle = node.getBooleanMemberOrDefault("forcePathStyle", false) - val useArnRegion = node.getBooleanMemberOrDefault("useArnRegion", true) - val useMultiRegionAccessPoints = node.getBooleanMemberOrDefault("useMultiRegionAccessPoints", true) - - region?.let { writer.rust(".region(crate::config::Region::new(${it.dq()}))") } -// sigv4aRegionSet?.let { writer.rust("._($it)") } -// useAccountIdRouting?.let { writer.rust("._($it)") } - useDualstack?.let { writer.rust(".use_dual_stack($it)") } - useFips?.let { writer.rust(".use_fips($it)") } - uri?.let { writer.rust(".endpoint_url($it)") } - useAccelerate?.let { writer.rust(".accelerate_($it)") } -// useGlobalEndpoint?.let { writer.rust(".use_global_endpoint_($it)")} - forcePathStyle?.let { writer.rust(".force_path_style_($it)") } - useArnRegion?.let { writer.rust(".use_arn_region($it)") } - useMultiRegionAccessPoints?.let { writer.rust(".disable_multi_region_access_points(!$it)") } + + val vendorParams = AwsSmokeTestModel.getAwsVendorParams(testCase) + vendorParams.orNull()?.let { params -> + writer.rust(".region(crate::config::Region::new(${params.region.dq()}))") +// writer.rust(".region(crate::config::Region::new(${params.sigv4aRegionSet.orElse(listOf()).joinToString(", ").dq()}))") +// writer.rust(".use_account_id_routing(${params.useAccountIdRouting()})") + writer.rust(".use_dual_stack(${params.useDualstack()})") + writer.rust(".use_fips(${params.useFips()})") + params.uri.orNull()?.let { writer.rust(".endpoint_url($it)") } } + + val s3VendorParams = AwsSmokeTestModel.getS3VendorParams(testCase) + s3VendorParams.orNull()?.let { params -> + writer.rust(".accelerate_(${params.useAccelerate()})") +// writer.rust(".use_global_endpoint_(${params.useGlobalEndpoint()})") + writer.rust(".force_path_style_(${params.forcePathStyle()})") + writer.rust(".use_arn_region(${params.useArnRegion()})") + writer.rust(".disable_multi_region_access_points(${params.useMultiRegionAccessPoints().not()})") + } + writer.rust(".build();") writer.dedent() } From 65f5d1ab1ef648da5797d54ed710c513798ba9b6 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Mon, 29 Jul 2024 10:16:36 -0500 Subject: [PATCH 5/9] codegen smoketests to their own file update smoketest cfg flag name --- .../smithy/rustsdk/SmokeTestsDecorator.kt | 119 +++++++++++------- .../smithy/rustsdk/SmokeTestsDecoratorTest.kt | 96 ++++++++++++++ .../smithy/generators/OperationGenerator.kt | 6 - .../generators/OperationUnitTestGenerator.kt | 45 ------- tools/ci-scripts/check-aws-sdk-services | 14 +-- 5 files changed, 177 insertions(+), 103 deletions(-) create mode 100644 aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecoratorTest.kt delete mode 100644 codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index 2e1ed14729..e662d58b18 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -6,30 +6,31 @@ package software.amazon.smithy.rustsdk import software.amazon.smithy.aws.smoketests.model.AwsSmokeTestModel +import software.amazon.smithy.model.Model import software.amazon.smithy.model.node.ObjectNode import software.amazon.smithy.model.shapes.MemberShape import software.amazon.smithy.model.shapes.OperationShape import software.amazon.smithy.model.shapes.StructureShape import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext import software.amazon.smithy.rust.codegen.client.smithy.customize.ClientCodegenDecorator -import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationCustomization -import software.amazon.smithy.rust.codegen.client.smithy.generators.OperationSection import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator import software.amazon.smithy.rust.codegen.core.rustlang.Attribute import software.amazon.smithy.rust.codegen.core.rustlang.Attribute.Companion.cfg +import software.amazon.smithy.rust.codegen.core.rustlang.AttributeKind import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter -import software.amazon.smithy.rust.codegen.core.rustlang.Writable +import software.amazon.smithy.rust.codegen.core.rustlang.containerDocs +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.rustlang.writable import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext +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 import software.amazon.smithy.rust.codegen.core.smithy.generators.setterName +import software.amazon.smithy.rust.codegen.core.testutil.integrationTest import software.amazon.smithy.rust.codegen.core.util.dq import software.amazon.smithy.rust.codegen.core.util.expectTrait import software.amazon.smithy.rust.codegen.core.util.inputShape -import software.amazon.smithy.rust.codegen.core.util.letIf import software.amazon.smithy.rust.codegen.core.util.orNull import software.amazon.smithy.rust.codegen.core.util.toSnakeCase import software.amazon.smithy.smoketests.traits.Expectation @@ -41,44 +42,50 @@ class SmokeTestsDecorator : ClientCodegenDecorator { override val name: String = "SmokeTests" override val order: Byte = 0 - override fun operationCustomizations( + override fun extras( codegenContext: ClientCodegenContext, - operation: OperationShape, - baseCustomizations: List, - ): List = - baseCustomizations.letIf(operation.hasTrait(SmokeTestsTrait.ID)) { - it + SmokeTestsOperationCustomization(codegenContext, operation) - } -} - -class SmokeTestsOperationCustomization( - private val codegenContext: ClientCodegenContext, - private val operation: OperationShape, -) : OperationCustomization() { - private val smokeTestsTrait = operation.expectTrait() - private val testCases: List = smokeTestsTrait.testCases - private val operationInput = operation.inputShape(codegenContext.model) - - override fun section(section: OperationSection): Writable { - if (testCases.isEmpty()) return emptySection - - return when (section) { - is OperationSection.UnitTests -> - writable { - testCases.forEach { testCase -> - Attribute(cfg("v2SmokeTests")).render(this) - Attribute.TokioTest.render(this) - this.rustBlock("async fn test_${testCase.id.toSnakeCase()}()") { - val instantiator = SmokeTestsInstantiator(codegenContext) - instantiator.renderConf(this, testCase) - rust("let client = crate::Client::from_conf(conf);") - instantiator.renderInput(this, operation, operationInput, testCase.params) - instantiator.renderExpectation(this, testCase.expectation) - } + rustCrate: RustCrate, + ) { + val smokeTestedOperations = codegenContext.model.getOperationShapesWithTrait(SmokeTestsTrait::class.java).toList() + if (smokeTestedOperations.isEmpty()) return + + rustCrate.integrationTest("smoketests") { + // Don't run the tests in this module unless `RUSTFLAGS="--cfg smoketests"` is passed. + Attribute(cfg("smoketests")).render(this, AttributeKind.Inner) + + containerDocs( + """ + The tests in this module run against live AWS services. As such, + they are disabled by default. To enable them, run the tests with + + ```sh + RUSTFLAGS="--cfg smoketests" cargo test. + ```""", + ) + + val model = codegenContext.model + val moduleUseName = codegenContext.moduleUseName() + rust("use $moduleUseName::{ Client, config };") + + for (operationShape in smokeTestedOperations) { + val operationName = operationShape.id.name.toSnakeCase() + val operationInput = operationShape.inputShape(model) + val smokeTestsTrait = operationShape.expectTrait() + val testCases: List = smokeTestsTrait.testCases + + docs("Smoke tests for the `$operationName` operation") + + for (testCase in testCases) { + Attribute.TokioTest.render(this) + this.rustBlock("async fn test_${testCase.id.toSnakeCase()}()") { + val instantiator = SmokeTestsInstantiator(codegenContext) + instantiator.renderConf(this, testCase) + rust("let client = Client::from_conf(conf);") + instantiator.renderInput(this, operationShape, operationInput, testCase.params) + instantiator.renderExpectation(this, model, testCase.expectation) } } - - else -> emptySection + } } } } @@ -102,15 +109,21 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : writer: RustWriter, testCase: SmokeTestCase, ) { - writer.rust("let conf = crate::config::Builder::new()") + writer.rust("let conf = config::Builder::new()") writer.indent() - writer.rust(".behavior_version(crate::config::BehaviorVersion::latest())") + writer.rust(".behavior_version(config::BehaviorVersion::latest())") val vendorParams = AwsSmokeTestModel.getAwsVendorParams(testCase) vendorParams.orNull()?.let { params -> - writer.rust(".region(crate::config::Region::new(${params.region.dq()}))") + writer.rust(".region(config::Region::new(${params.region.dq()}))") + if (params.sigv4aRegionSet.isPresent) { + throw NotImplementedError("sigv4aRegionSet is not supported") // writer.rust(".region(crate::config::Region::new(${params.sigv4aRegionSet.orElse(listOf()).joinToString(", ").dq()}))") + } + if (params.useAccountIdRouting()) { + throw NotImplementedError("useAccountIdRouting is not supported") // writer.rust(".use_account_id_routing(${params.useAccountIdRouting()})") + } writer.rust(".use_dual_stack(${params.useDualstack()})") writer.rust(".use_fips(${params.useFips()})") params.uri.orNull()?.let { writer.rust(".endpoint_url($it)") } @@ -119,7 +132,10 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : val s3VendorParams = AwsSmokeTestModel.getS3VendorParams(testCase) s3VendorParams.orNull()?.let { params -> writer.rust(".accelerate_(${params.useAccelerate()})") + if (params.useGlobalEndpoint()) { + throw NotImplementedError("useGlobalEndpoint is not supported") // writer.rust(".use_global_endpoint_(${params.useGlobalEndpoint()})") + } writer.rust(".force_path_style_(${params.forcePathStyle()})") writer.rust(".use_arn_region(${params.useArnRegion()})") writer.rust(".disable_multi_region_access_points(${params.useMultiRegionAccessPoints().not()})") @@ -151,12 +167,27 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : fun renderExpectation( writer: RustWriter, + model: Model, expectation: Expectation, ) { if (expectation.isSuccess) { writer.rust("""res.expect("request should succeed");""") } else if (expectation.isFailure) { - writer.rust("""res.expect_err("request should fail");""") + val expectedErrShape = expectation.failure.orNull()?.errorId?.orNull() + println(expectedErrShape) + if (expectedErrShape != null) { + val failureShape = model.expectShape(expectedErrShape) + val errName = codegenContext.symbolProvider.toSymbol(failureShape).name.toSnakeCase() + writer.rust( + """ + let err = res.expect_err("request should fail"); + let err = err.into_service_error(); + assert!(err.is_$errName()) + """, + ) + } else { + writer.rust("""res.expect_err("request should fail");""") + } } } } diff --git a/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecoratorTest.kt b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecoratorTest.kt new file mode 100644 index 0000000000..8a4180aeb0 --- /dev/null +++ b/aws/sdk-codegen/src/test/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecoratorTest.kt @@ -0,0 +1,96 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.rustsdk + +import org.junit.jupiter.api.Test +import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel + +class SmokeTestsDecoratorTest { + companion object { + // Can't use the dollar sign in a multiline string with doing it like this. + private const val PREFIX = "\$version: \"2\"" + val model = + """ + $PREFIX + namespace test + + use aws.api#service + use smithy.test#smokeTests + use aws.auth#sigv4 + use aws.protocols#restJson1 + use smithy.rules#endpointRuleSet + + @service(sdkId: "dontcare") + @restJson1 + @sigv4(name: "dontcare") + @auth([sigv4]) + @endpointRuleSet({ + "version": "1.0", + "rules": [{ "type": "endpoint", "conditions": [], "endpoint": { "url": "https://example.com" } }], + "parameters": { + "Region": { "required": false, "type": "String", "builtIn": "AWS::Region" }, + } + }) + service TestService { + version: "2023-01-01", + operations: [SomeOperation] + } + + @smokeTests([ + { + id: "SomeOperationSuccess", + params: {} + vendorParams: { + region: "us-west-2" + } + expect: { success: {} } + } + { + id: "SomeOperationFailure", + params: {} + vendorParams: { + region: "us-west-2" + } + expect: { failure: {} } + } + { + id: "SomeOperationFailureExplicitShape", + params: {} + vendorParams: { + region: "us-west-2" + } + expect: { + failure: { errorId: FooException } + } + } + ]) + @http(uri: "/SomeOperation", method: "POST") + @optionalAuth + operation SomeOperation { + input: SomeInput, + output: SomeOutput, + errors: [FooException] + } + + @input + structure SomeInput {} + + @output + structure SomeOutput {} + + @error("server") + structure FooException { } + """.asSmithyModel() + } + + @Test + fun smokeTestSdkCodegen() { + awsSdkIntegrationTest(model) { _, _ -> + // It should compile. We can't run the tests + // because they don't target a real service. + } + } +} diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt index 9a617d62b8..c2200003db 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationGenerator.kt @@ -211,11 +211,5 @@ open class OperationGenerator( EndpointParamsInterceptorGenerator(codegenContext) .render(operationWriter, operationShape) - - OperationUnitTestGenerator(codegenContext).render( - operationWriter, - operationShape, - operationCustomizations, - ) } } diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt deleted file mode 100644 index c0e12f71ee..0000000000 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationUnitTestGenerator.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -package software.amazon.smithy.rust.codegen.client.smithy.generators - -import software.amazon.smithy.model.shapes.OperationShape -import software.amazon.smithy.rust.codegen.client.smithy.ClientCodegenContext -import software.amazon.smithy.rust.codegen.core.rustlang.RustWriter -import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate -import software.amazon.smithy.rust.codegen.core.rustlang.writable -import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType.Companion.preludeScope -import software.amazon.smithy.rust.codegen.core.smithy.customize.writeCustomizations - -/** - * Generates operation-level unit tests - */ -class OperationUnitTestGenerator( - private val codegenContext: ClientCodegenContext, -) { - fun render( - writer: RustWriter, - operationShape: OperationShape, - customizations: List, - ) { - // TODO(smithy-rs#3759) don't generate this if there are no customizations adding unit tests. - writer.rustTemplate( - """ - ##[cfg(test)] - mod test { - #{unit_tests} - } - """, - *preludeScope, - "unit_tests" to - writable { - writeCustomizations( - customizations, - OperationSection.UnitTests(customizations, operationShape), - ) - }, - ) - } -} diff --git a/tools/ci-scripts/check-aws-sdk-services b/tools/ci-scripts/check-aws-sdk-services index c6b13d4c62..49846e334b 100755 --- a/tools/ci-scripts/check-aws-sdk-services +++ b/tools/ci-scripts/check-aws-sdk-services @@ -7,17 +7,15 @@ set -eux cd aws-sdk -# Check if the VERBOSE environment variable is set -if [ -n "$ENABLE_V2_SMOKETESTS" ]; then - RUN_V2_SMOKETESTS="--cfg v2SmokeTests" +# Check if the $ENABLE_SMOKETESTS environment variable is set +if [ -n "$ENABLE_SMOKETESTS" ]; then + # Invoking `cargo test` at the root directory implicitly checks for the validity + # of the top-level `Cargo.toml` + RUSTFLAGS="--cfg smoketests" cargo test --all-features else - RUN_V2_SMOKETESTS="" + cargo test --all-features fi -# Invoking `cargo test` at the root directory implicitly checks for the validity -# of the top-level `Cargo.toml` -cargo test --all-features -- "$RUN_V2_SMOKETESTS" - for test_dir in tests/*; do if [ -f "${test_dir}/Cargo.toml" ]; then echo "#### Testing ${test_dir}..." From fb0a74cf6018543ec1a9ccd8f0612cd47f3be03b Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Mon, 29 Jul 2024 10:23:45 -0500 Subject: [PATCH 6/9] remove OperationCustomization.UnitTests section --- .../client/smithy/generators/OperationCustomization.kt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt index 0017519a93..07ed4e51cb 100644 --- a/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt +++ b/codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/OperationCustomization.kt @@ -125,14 +125,6 @@ sealed class OperationSection(name: String) : Section(name) { writer.rustTemplate(".with_retry_classifier(#{classifier})", "classifier" to classifier) } } - - /** - * Hook to add unit tests for an operation. - */ - data class UnitTests( - override val customizations: List, - val operationShape: OperationShape, - ) : OperationSection("UnitTests") } abstract class OperationCustomization : NamedCustomization() From 62ff67ed89b1d920540b03a252a69bf50a1d1081 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Mon, 29 Jul 2024 12:46:12 -0500 Subject: [PATCH 7/9] skip rendering smoketests with unsupported vendorParams --- .../smithy/rustsdk/SmokeTestsDecorator.kt | 58 +++++++++++++------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index e662d58b18..5f174bf0f6 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -37,17 +37,55 @@ import software.amazon.smithy.smoketests.traits.Expectation import software.amazon.smithy.smoketests.traits.SmokeTestCase import software.amazon.smithy.smoketests.traits.SmokeTestsTrait import java.util.Optional +import java.util.logging.Logger class SmokeTestsDecorator : ClientCodegenDecorator { override val name: String = "SmokeTests" override val order: Byte = 0 + private val logger: Logger = Logger.getLogger(javaClass.name) + + private fun isSmokeTestSupported(smokeTestCase: SmokeTestCase): Boolean { + AwsSmokeTestModel.getAwsVendorParams(smokeTestCase)?.orNull()?.let { vendorParams -> + if (vendorParams.sigv4aRegionSet.isPresent) { + logger.warning("skipping smoketest `${smokeTestCase.id}` with unsupported vendorParam `sigv4aRegionSet`") + return false + } + if (vendorParams.useAccountIdRouting()) { + logger.warning("skipping smoketest `${smokeTestCase.id}` with unsupported vendorParam `useAccountIdRouting`") + return false + } + } + AwsSmokeTestModel.getS3VendorParams(smokeTestCase)?.orNull()?.let { s3VendorParams -> + if (s3VendorParams.useGlobalEndpoint()) { + logger.warning("skipping smoketest `${smokeTestCase.id}` with unsupported vendorParam `useGlobalEndpoint`") + return false + } + } + + return true + } override fun extras( codegenContext: ClientCodegenContext, rustCrate: RustCrate, ) { - val smokeTestedOperations = codegenContext.model.getOperationShapesWithTrait(SmokeTestsTrait::class.java).toList() - if (smokeTestedOperations.isEmpty()) return + // Get all operations with smoke tests + val smokeTestedOperations = + codegenContext.model.getOperationShapesWithTrait(SmokeTestsTrait::class.java).toList() + val supportedTests = + smokeTestedOperations.map { operationShape -> + // filter out unsupported smoke tests, logging a warning for each one. + val testCases = + operationShape.expectTrait().testCases.filter { smokeTestCase -> + isSmokeTestSupported(smokeTestCase) + } + + operationShape to testCases + } + // filter out operations with no supported smoke tests + .filter { (_, testCases) -> testCases.isNotEmpty() } + // Return if there are no supported smoke tests across all operations + if (supportedTests.isEmpty()) return rustCrate.integrationTest("smoketests") { // Don't run the tests in this module unless `RUSTFLAGS="--cfg smoketests"` is passed. @@ -67,11 +105,9 @@ class SmokeTestsDecorator : ClientCodegenDecorator { val moduleUseName = codegenContext.moduleUseName() rust("use $moduleUseName::{ Client, config };") - for (operationShape in smokeTestedOperations) { + for ((operationShape, testCases) in supportedTests) { val operationName = operationShape.id.name.toSnakeCase() val operationInput = operationShape.inputShape(model) - val smokeTestsTrait = operationShape.expectTrait() - val testCases: List = smokeTestsTrait.testCases docs("Smoke tests for the `$operationName` operation") @@ -116,14 +152,6 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : val vendorParams = AwsSmokeTestModel.getAwsVendorParams(testCase) vendorParams.orNull()?.let { params -> writer.rust(".region(config::Region::new(${params.region.dq()}))") - if (params.sigv4aRegionSet.isPresent) { - throw NotImplementedError("sigv4aRegionSet is not supported") -// writer.rust(".region(crate::config::Region::new(${params.sigv4aRegionSet.orElse(listOf()).joinToString(", ").dq()}))") - } - if (params.useAccountIdRouting()) { - throw NotImplementedError("useAccountIdRouting is not supported") -// writer.rust(".use_account_id_routing(${params.useAccountIdRouting()})") - } writer.rust(".use_dual_stack(${params.useDualstack()})") writer.rust(".use_fips(${params.useFips()})") params.uri.orNull()?.let { writer.rust(".endpoint_url($it)") } @@ -132,10 +160,6 @@ class SmokeTestsInstantiator(private val codegenContext: ClientCodegenContext) : val s3VendorParams = AwsSmokeTestModel.getS3VendorParams(testCase) s3VendorParams.orNull()?.let { params -> writer.rust(".accelerate_(${params.useAccelerate()})") - if (params.useGlobalEndpoint()) { - throw NotImplementedError("useGlobalEndpoint is not supported") -// writer.rust(".use_global_endpoint_(${params.useGlobalEndpoint()})") - } writer.rust(".force_path_style_(${params.forcePathStyle()})") writer.rust(".use_arn_region(${params.useArnRegion()})") writer.rust(".disable_multi_region_access_points(${params.useMultiRegionAccessPoints().not()})") From 84c7892047c5e0fdec92ac6619ca3c89fc41c965 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Tue, 30 Jul 2024 10:20:10 -0500 Subject: [PATCH 8/9] add TODO for account ID routing --- .../software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt index 5f174bf0f6..a224fe4f25 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/SmokeTestsDecorator.kt @@ -50,6 +50,8 @@ 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 From 71636d4191a071aa2cad811549f3f53bd5c7de46 Mon Sep 17 00:00:00 2001 From: Zelda Hessler Date: Tue, 30 Jul 2024 10:23:12 -0500 Subject: [PATCH 9/9] revert `check-aws-sdk-services` script changes --- tools/ci-scripts/check-aws-sdk-services | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/ci-scripts/check-aws-sdk-services b/tools/ci-scripts/check-aws-sdk-services index 49846e334b..2c86e975e8 100755 --- a/tools/ci-scripts/check-aws-sdk-services +++ b/tools/ci-scripts/check-aws-sdk-services @@ -7,14 +7,9 @@ set -eux cd aws-sdk -# Check if the $ENABLE_SMOKETESTS environment variable is set -if [ -n "$ENABLE_SMOKETESTS" ]; then - # Invoking `cargo test` at the root directory implicitly checks for the validity - # of the top-level `Cargo.toml` - RUSTFLAGS="--cfg smoketests" cargo test --all-features -else - cargo test --all-features -fi +# Invoking `cargo test` at the root directory implicitly checks for the validity +# of the top-level `Cargo.toml` +cargo test --all-features for test_dir in tests/*; do if [ -f "${test_dir}/Cargo.toml" ]; then