From 0dca99a8ae3c49b026a78399709c4fe8b0facc47 Mon Sep 17 00:00:00 2001 From: David Souther Date: Wed, 11 Oct 2023 17:37:02 -0400 Subject: [PATCH] Update from TestConnector to StaticReplayClient --- rust_dev_preview/examples/dynamodb/Cargo.toml | 23 ++++++++----------- .../examples/dynamodb/src/scenario/list.rs | 8 +++---- rust_dev_preview/test-utils/Cargo.toml | 5 ++-- rust_dev_preview/test-utils/src/macros.rs | 6 ++--- rust_dev_preview/test-utils/src/mod.rs | 4 ++-- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/rust_dev_preview/examples/dynamodb/Cargo.toml b/rust_dev_preview/examples/dynamodb/Cargo.toml index 94ce4ec7a45..94085e4ee72 100644 --- a/rust_dev_preview/examples/dynamodb/Cargo.toml +++ b/rust_dev_preview/examples/dynamodb/Cargo.toml @@ -12,30 +12,25 @@ edition = "2021" [dependencies] aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-sdk-dynamodb = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } aws-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-client = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ - "client-hyper", - "rustls", - "rt-tokio", -] } -aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ - "rt-tokio", -] } +aws-sdk-dynamodb = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-client = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ "client-hyper", "rustls", "rt-tokio", ] } +aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ "rt-tokio", ] } +aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["test-util"] } aws-smithy-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } axum = "0.5.16" -http = "0.2.5" +clap = { version = "~4.2", features = ["derive"] } futures = "0.3" +http = "0.2.5" log = "0.4.17" rand = "0.8.3" sdk-examples-test-utils = { path = "../../test-utils" } serde = {version = "1.0", features = ["derive"]} -serde_json = "1" serde_dynamo = { version = "4", features = ["aws-sdk-dynamodb+0_22"] } -clap = { version = "~4.2", features = ["derive"] } -tracing = "0.1" +serde_json = "1" thiserror = "1.0" tokio = { version = "1.20.1", features = ["full"] } tokio-stream = "0.1.8" tower-http = { version = "0.3.0", features = ["cors"] } -tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } \ No newline at end of file diff --git a/rust_dev_preview/examples/dynamodb/src/scenario/list.rs b/rust_dev_preview/examples/dynamodb/src/scenario/list.rs index 6809d082fee..599f6cb32ce 100644 --- a/rust_dev_preview/examples/dynamodb/src/scenario/list.rs +++ b/rust_dev_preview/examples/dynamodb/src/scenario/list.rs @@ -119,8 +119,8 @@ mod test_list_more_tables { async fn test_list_tables_iterative() { let client = aws_sdk_dynamodb::Client::from_conf( sdk_examples_test_utils::client_config!(aws_sdk_dynamodb) - .http_connector(aws_smithy_client::test_connection::TestConnection::new( - vec![ + .http_client( + aws_smithy_runtime::client::http::test_util::StaticReplayClient::new(vec![ test_event!( "", ( @@ -136,8 +136,8 @@ mod test_list_more_tables { ) ), test_event!("", (200, r#"{"TableNames":["g","h"]}"#)), - ], - )) + ]), + ) .build(), ); diff --git a/rust_dev_preview/test-utils/Cargo.toml b/rust_dev_preview/test-utils/Cargo.toml index 25b0e0ddfe8..815d5cec597 100644 --- a/rust_dev_preview/test-utils/Cargo.toml +++ b/rust_dev_preview/test-utils/Cargo.toml @@ -10,10 +10,9 @@ edition = "2021" [dependencies] aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } -aws-smithy-client = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ - "test-util", -] } +aws-smithy-client = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = [ "test-util", ] } aws-smithy-http = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next" } +aws-smithy-runtime = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next", features = ["test-util"] } aws-types = { git = "https://github.com/awslabs/aws-sdk-rust", branch = "next"} http = "0.2" diff --git a/rust_dev_preview/test-utils/src/macros.rs b/rust_dev_preview/test-utils/src/macros.rs index 52f437496e3..e5532383a99 100644 --- a/rust_dev_preview/test-utils/src/macros.rs +++ b/rust_dev_preview/test-utils/src/macros.rs @@ -20,7 +20,7 @@ macro_rules! test_event { $res:expr ) ) => {{ - ( + aws_smithy_runtime::client::http::test_util::ReplayEvent::new( http::Request::builder() .body(aws_smithy_http::body::SdkBody::from($req)) .unwrap(), @@ -38,7 +38,7 @@ macro_rules! test_event { $res:expr ) ) => {{ - ( + aws_smithy_runtime::client::http::test_util::ReplayEvent::new( http::Request::builder() .body(aws_smithy_http::body::SdkBody::from($req)) .unwrap(), @@ -73,7 +73,7 @@ macro_rules! single_shot_client { ($sdk_crate:ident, $req:expr, $status:expr, $res_headers:expr, $res:expr) => {{ $sdk_crate::Client::from_conf( sdk_examples_test_utils::client_config!($sdk_crate) - .http_connector(sdk_examples_test_utils::single_shot( + .http_client(sdk_examples_test_utils::single_shot( $req.into(), ($status.try_into().unwrap(), $res_headers, $res.into()), )) diff --git a/rust_dev_preview/test-utils/src/mod.rs b/rust_dev_preview/test-utils/src/mod.rs index 40a301bdaa2..a8a97c6733e 100644 --- a/rust_dev_preview/test-utils/src/mod.rs +++ b/rust_dev_preview/test-utils/src/mod.rs @@ -8,8 +8,8 @@ pub mod macros; pub fn single_shot( req: SdkBody, res: (http::StatusCode, Vec<(&str, &str)>, SdkBody), -) -> aws_smithy_client::test_connection::TestConnection { - aws_smithy_client::test_connection::TestConnection::new(vec![ +) -> aws_smithy_runtime::client::http::test_util::StaticReplayClient { + aws_smithy_runtime::client::http::test_util::StaticReplayClient::new(vec![ (test_event!(req, (res.0, res.1, res.2))), ]) }