Loading aws/rust-runtime/aws-hyper/Cargo.toml +7 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,9 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] test-util = ["protocol-test-helpers"] [dependencies] hyper = { version = "0.14.2", features = ["client", "http1", "http2", "tcp", "runtime"] } tower = { version = "0.4.6", features = ["util", "retry"] } Loading @@ -22,9 +25,12 @@ smithy-types = { path = "../../../rust-runtime/smithy-types" } smithy-http-tower = { path = "../../../rust-runtime/smithy-http-tower" } fastrand = "1.4.0" tokio = { version = "1", features = ["time"] } pin-project = "1" tracing = "0.1.25" protocol-test-helpers = { path = "../../../rust-runtime/protocol-test-helpers", optional = true } [dev-dependencies] tokio = { version = "1", features = ["full", "test-util"] } tower-test = "0.4.0" Loading aws/rust-runtime/aws-hyper/src/lib.rs +1 −0 Original line number Diff line number Diff line pub mod conn; mod retry; #[cfg(feature = "test-util")] pub mod test_connection; pub use retry::RetryConfig; Loading aws/rust-runtime/aws-hyper/src/test_connection.rs +14 −7 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0. */ use http::header::HeaderName; use http::header::{HeaderName, CONTENT_TYPE}; use http::Request; use smithy_http::body::SdkBody; use std::future::Ready; Loading @@ -11,6 +11,7 @@ use std::ops::Deref; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use tower::BoxError; use protocol_test_helpers::{validate_body, MediaType, assert_ok}; type ConnectVec<B> = Vec<(http::Request<SdkBody>, http::Response<B>)>; Loading @@ -33,8 +34,14 @@ impl ValidateRequest { } let actual_str = std::str::from_utf8(actual.body().bytes().unwrap_or(&[])); let expected_str = std::str::from_utf8(expected.body().bytes().unwrap_or(&[])); let media_type = if actual.headers().get(CONTENT_TYPE).map(|v| v.to_str().unwrap().contains("json")).unwrap_or(false) { MediaType::Json } else { MediaType::Other("unknown".to_string()) }; match (actual_str, expected_str) { (Ok(actual), Ok(expected)) => assert_eq!(actual, expected), (Ok(actual), Ok(expected)) => assert_ok(validate_body(actual, expected, media_type)), _ => assert_eq!(actual.body().bytes(), expected.body().bytes()), }; assert_eq!(actual.uri(), expected.uri()); Loading aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsHyperDevDep.kt +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import software.amazon.smithy.rust.codegen.smithy.generators.LibRsSection import software.amazon.smithy.rust.codegen.smithy.generators.ProtocolConfig import software.amazon.smithy.rust.codegen.smithy.letIf val TestedServices = setOf("kms") val TestedServices = setOf("kms", "dynamodb") class IntegrationTestDecorator : RustCodegenDecorator { override val name: String = "IntegrationTest" Loading @@ -41,5 +41,5 @@ class AwsHyperDevDep(private val runtimeConfig: RuntimeConfig) : LibRsCustomizat } } val Tokio = CargoDependency("tokio", CratesIo("1"), features = listOf("macros"), scope = DependencyScope.Dev) fun RuntimeConfig.awsHyper() = CargoDependency("aws-hyper", Local(relativePath)) val Tokio = CargoDependency("tokio", CratesIo("1"), features = listOf("macros", "test-util"), scope = DependencyScope.Dev) fun RuntimeConfig.awsHyper() = CargoDependency("aws-hyper", Local(relativePath), features = listOf("test-util")) aws/sdk/build.gradle.kts +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ plugins { val smithyVersion: String by project val sdkOutputDir = buildDir.resolve("aws-sdk") val runtimeModules = listOf("smithy-types", "smithy-http", "smithy-http-tower") val runtimeModules = listOf("smithy-types", "smithy-http", "smithy-http-tower", "protocol-test-helpers") val awsModules = listOf("aws-auth", "aws-endpoint", "aws-types", "aws-hyper", "aws-sig-auth", "aws-http") buildscript { Loading Loading
aws/rust-runtime/aws-hyper/Cargo.toml +7 −1 Original line number Diff line number Diff line Loading @@ -6,6 +6,9 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] test-util = ["protocol-test-helpers"] [dependencies] hyper = { version = "0.14.2", features = ["client", "http1", "http2", "tcp", "runtime"] } tower = { version = "0.4.6", features = ["util", "retry"] } Loading @@ -22,9 +25,12 @@ smithy-types = { path = "../../../rust-runtime/smithy-types" } smithy-http-tower = { path = "../../../rust-runtime/smithy-http-tower" } fastrand = "1.4.0" tokio = { version = "1", features = ["time"] } pin-project = "1" tracing = "0.1.25" protocol-test-helpers = { path = "../../../rust-runtime/protocol-test-helpers", optional = true } [dev-dependencies] tokio = { version = "1", features = ["full", "test-util"] } tower-test = "0.4.0" Loading
aws/rust-runtime/aws-hyper/src/lib.rs +1 −0 Original line number Diff line number Diff line pub mod conn; mod retry; #[cfg(feature = "test-util")] pub mod test_connection; pub use retry::RetryConfig; Loading
aws/rust-runtime/aws-hyper/src/test_connection.rs +14 −7 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0. */ use http::header::HeaderName; use http::header::{HeaderName, CONTENT_TYPE}; use http::Request; use smithy_http::body::SdkBody; use std::future::Ready; Loading @@ -11,6 +11,7 @@ use std::ops::Deref; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use tower::BoxError; use protocol_test_helpers::{validate_body, MediaType, assert_ok}; type ConnectVec<B> = Vec<(http::Request<SdkBody>, http::Response<B>)>; Loading @@ -33,8 +34,14 @@ impl ValidateRequest { } let actual_str = std::str::from_utf8(actual.body().bytes().unwrap_or(&[])); let expected_str = std::str::from_utf8(expected.body().bytes().unwrap_or(&[])); let media_type = if actual.headers().get(CONTENT_TYPE).map(|v| v.to_str().unwrap().contains("json")).unwrap_or(false) { MediaType::Json } else { MediaType::Other("unknown".to_string()) }; match (actual_str, expected_str) { (Ok(actual), Ok(expected)) => assert_eq!(actual, expected), (Ok(actual), Ok(expected)) => assert_ok(validate_body(actual, expected, media_type)), _ => assert_eq!(actual.body().bytes(), expected.body().bytes()), }; assert_eq!(actual.uri(), expected.uri()); Loading
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsHyperDevDep.kt +3 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ import software.amazon.smithy.rust.codegen.smithy.generators.LibRsSection import software.amazon.smithy.rust.codegen.smithy.generators.ProtocolConfig import software.amazon.smithy.rust.codegen.smithy.letIf val TestedServices = setOf("kms") val TestedServices = setOf("kms", "dynamodb") class IntegrationTestDecorator : RustCodegenDecorator { override val name: String = "IntegrationTest" Loading @@ -41,5 +41,5 @@ class AwsHyperDevDep(private val runtimeConfig: RuntimeConfig) : LibRsCustomizat } } val Tokio = CargoDependency("tokio", CratesIo("1"), features = listOf("macros"), scope = DependencyScope.Dev) fun RuntimeConfig.awsHyper() = CargoDependency("aws-hyper", Local(relativePath)) val Tokio = CargoDependency("tokio", CratesIo("1"), features = listOf("macros", "test-util"), scope = DependencyScope.Dev) fun RuntimeConfig.awsHyper() = CargoDependency("aws-hyper", Local(relativePath), features = listOf("test-util"))
aws/sdk/build.gradle.kts +1 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ plugins { val smithyVersion: String by project val sdkOutputDir = buildDir.resolve("aws-sdk") val runtimeModules = listOf("smithy-types", "smithy-http", "smithy-http-tower") val runtimeModules = listOf("smithy-types", "smithy-http", "smithy-http-tower", "protocol-test-helpers") val awsModules = listOf("aws-auth", "aws-endpoint", "aws-types", "aws-hyper", "aws-sig-auth", "aws-http") buildscript { Loading