Skip to content

Commit

Permalink
chore: ensure test-util feature is applied to dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardomourar committed Jan 26, 2023
1 parent 59791df commit 7478507
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ 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.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.writable
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
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.setterName
Expand Down Expand Up @@ -147,7 +148,7 @@ class OperationInputTestGenerator(_ctx: ClientCodegenContext, private val test:
#{assertion}
""",
"capture_request" to CargoDependency.smithyClient(runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("test_connection::capture_request"),
"conf" to config(testOperationInput),
"invoke_operation" to operationInvocation(testOperationInput),
"assertion" to writable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package software.amazon.smithy.rustsdk
import org.junit.jupiter.api.Test
import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency
import software.amazon.smithy.rust.codegen.core.rustlang.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
import software.amazon.smithy.rust.codegen.core.testutil.asSmithyModel
import software.amazon.smithy.rust.codegen.core.testutil.integrationTest
import software.amazon.smithy.rust.codegen.core.testutil.tokioTest
Expand Down Expand Up @@ -97,9 +98,9 @@ class EndpointsCredentialsTest {
assert!(auth_header.contains("/us-west-2/foobaz/aws4_request"), "{}", auth_header);
""",
"capture_request" to CargoDependency.smithyClient(context.runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("test_connection::capture_request"),
"Credentials" to AwsCargoDependency.awsCredentialTypes(context.runtimeConfig)
.withFeature("test-util").toType().resolve("Credentials"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("Credentials"),
"Region" to AwsRuntimeType.awsTypes(context.runtimeConfig).resolve("region::Region"),
)
}
Expand All @@ -121,9 +122,9 @@ class EndpointsCredentialsTest {
assert!(auth_header.contains("/region-custom-auth/name-custom-auth/aws4_request"), "{}", auth_header);
""",
"capture_request" to CargoDependency.smithyClient(context.runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("test_connection::capture_request"),
"Credentials" to AwsCargoDependency.awsCredentialTypes(context.runtimeConfig)
.withFeature("test-util").toType().resolve("Credentials"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("Credentials"),
"Region" to AwsRuntimeType.awsTypes(context.runtimeConfig).resolve("region::Region"),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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.rustTemplate
import software.amazon.smithy.rust.codegen.core.rustlang.writable
import software.amazon.smithy.rust.codegen.core.rustlang.DependencyScope
import software.amazon.smithy.rust.codegen.core.smithy.CodegenContext
import software.amazon.smithy.rust.codegen.core.smithy.RuntimeType
import software.amazon.smithy.rust.codegen.core.util.PANIC
Expand All @@ -49,7 +50,7 @@ internal class EndpointTestGenerator(
"Document" to RuntimeType.document(runtimeConfig),
"HashMap" to RuntimeType.HashMap,
"capture_request" to CargoDependency.smithyClient(runtimeConfig)
.withFeature("test-util").toType().resolve("test_connection::capture_request"),
.copy(features = setOf("test-util"), scope = DependencyScope.Dev).toType().resolve("test_connection::capture_request"),
)

private val instantiator = clientInstantiator(codegenContext)
Expand Down

0 comments on commit 7478507

Please sign in to comment.