Skip to content

switch integration tests to new test-utils #3898

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

Merged
merged 12 commits into from
Nov 8, 2024
31 changes: 16 additions & 15 deletions aws/rust-runtime/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 14 additions & 11 deletions aws/rust-runtime/aws-config/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-config"
version = "1.5.10"
version = "1.6.0"
authors = [
"AWS Rust SDK Team <[email protected]>",
"Russell Cohen <[email protected]>",
Expand Down Expand Up @@ -35,7 +35,7 @@ aws-smithy-runtime-api = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtim
aws-smithy-types = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-types" }
aws-types = { path = "../../sdk/build/aws-sdk/sdk/aws-types" }
bytes = "1.1.0"
http = "0.2.4"
http = "1"
time = { version = "0.3.4", features = ["parsing"] }
tokio = { version = "1.13.1", features = ["sync"] }
tracing = { version = "0.1" }
Expand All @@ -55,6 +55,7 @@ aws-sdk-ssooidc = { path = "../../sdk/build/aws-sdk/sdk/ssooidc", default-featur

[dev-dependencies]
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "connector-hyper-0-14-x", "test-util"] }
aws-smithy-http-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-http-client", features = ["test-util"] }
aws-smithy-runtime-api = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["test-util"] }
futures-util = { version = "0.3.29", default-features = false }
tracing-test = "0.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ mod test {
use crate::provider_config::ProviderConfig;
use aws_credential_types::provider::error::CredentialsError;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_http_client::test_util::NeverTcpConnector;
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;
use aws_smithy_runtime::client::http::test_util::NeverTcpConnector;

tokio::time::pause();
let conf = ProviderConfig::no_configuration()
Expand Down
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-config/src/ecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
use crate::http_credential_provider::HttpCredentialProvider;
use crate::provider_config::ProviderConfig;
use aws_credential_types::provider::{self, error::CredentialsError, future, ProvideCredentials};
use aws_smithy_runtime::client::endpoint::apply_endpoint;
use aws_smithy_http::endpoint::apply_endpoint;
use aws_smithy_runtime_api::client::dns::{ResolveDns, ResolveDnsError, SharedDnsResolver};
use aws_smithy_runtime_api::client::http::HttpConnectorSettings;
use aws_smithy_runtime_api::shared::IntoShared;
Expand Down Expand Up @@ -498,7 +498,7 @@ mod test {
use aws_credential_types::Credentials;
use aws_smithy_async::future::never::Never;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_runtime_api::client::dns::DnsFuture;
use aws_smithy_runtime_api::client::http::HttpClient;
use aws_smithy_runtime_api::shared::IntoShared;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl ClassifyRetry for HttpCredentialRetryClassifier {
mod test {
use super::*;
use aws_credential_types::provider::error::CredentialsError;
use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_types::body::SdkBody;
use http::{Request, Response, Uri};
use std::time::SystemTime;
Expand Down
4 changes: 1 addition & 3 deletions aws/rust-runtime/aws-config/src/imds/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,7 @@ pub(crate) mod test {
use crate::provider_config::ProviderConfig;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_async::test_util::{instant_time_and_sleep, InstantSleep};
use aws_smithy_runtime::client::http::test_util::{
capture_request, ReplayEvent, StaticReplayClient,
};
use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
use aws_smithy_runtime_api::client::interceptors::context::{
Input, InterceptorContext, Output,
Expand Down
15 changes: 9 additions & 6 deletions aws/rust-runtime/aws-config/src/imds/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ impl ImdsCredentialsProvider {

async fn retrieve_credentials(&self) -> provider::Result {
if self.imds_disabled() {
tracing::debug!(
"IMDS disabled because AWS_EC2_METADATA_DISABLED env var was set to `true`"
let err = format!(
"IMDS disabled by {} env var set to `true`",
super::env::EC2_METADATA_DISABLED
);
return Err(CredentialsError::not_loaded(
"IMDS disabled by AWS_ECS_METADATA_DISABLED env var",
));
tracing::debug!(err);
return Err(CredentialsError::not_loaded(err));
}
tracing::debug!("loading credentials from IMDS");
let profile: Cow<'_, str> = match &self.profile {
Expand Down Expand Up @@ -289,7 +289,7 @@ mod test {
use crate::provider_config::ProviderConfig;
use aws_credential_types::provider::ProvideCredentials;
use aws_smithy_async::test_util::instant_time_and_sleep;
use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_types::body::SdkBody;
use std::time::{Duration, UNIX_EPOCH};
use tracing_test::traced_test;
Expand Down Expand Up @@ -322,6 +322,7 @@ mod test {
]);
let client = ImdsCredentialsProvider::builder()
.imds_client(make_imds_client(&http_client))
.configure(&ProviderConfig::no_configuration())
.build();
let creds1 = client.provide_credentials().await.expect("valid creds");
let creds2 = client.provide_credentials().await.expect("valid creds");
Expand Down Expand Up @@ -468,6 +469,7 @@ mod test {
let expected = aws_credential_types::Credentials::for_tests();
let provider = ImdsCredentialsProvider::builder()
.imds_client(client)
.configure(&ProviderConfig::no_configuration())
// seed fallback credentials for testing
.last_retrieved_credentials(expected.clone())
.build();
Expand Down Expand Up @@ -515,6 +517,7 @@ mod test {
]);
let provider = ImdsCredentialsProvider::builder()
.imds_client(make_imds_client(&http_client))
.configure(&ProviderConfig::no_configuration())
.build();
let creds1 = provider.provide_credentials().await.expect("valid creds");
assert_eq!(creds1.access_key_id(), "ASIARTEST");
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/imds/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mod test {
use crate::imds::region::ImdsRegionProvider;
use crate::provider_config::ProviderConfig;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_runtime::client::http::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_http_client::test_util::{ReplayEvent, StaticReplayClient};
use aws_smithy_types::body::SdkBody;
use aws_types::region::Region;
use tracing_test::traced_test;
Expand Down
2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ mod loader {
use crate::{defaults, ConfigLoader};
use aws_credential_types::provider::ProvideCredentials;
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_runtime::client::http::test_util::{infallible_client_fn, NeverClient};
use aws_smithy_http_client::test_util::{infallible_client_fn, NeverClient};
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
use aws_types::app_name::AppName;
use aws_types::origin::Origin;
Expand Down
5 changes: 2 additions & 3 deletions aws/rust-runtime/aws-config/src/sso/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,9 @@ mod tests {
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_async::test_util::instant_time_and_sleep;
use aws_smithy_async::time::{StaticTimeSource, TimeSource};
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
use aws_smithy_runtime::{
assert_str_contains,
client::http::test_util::{capture_request, ReplayEvent, StaticReplayClient},
assert_str_contains, test_util::capture_test_logs::capture_test_logs,
};
use aws_smithy_runtime_api::client::http::HttpClient;
use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
Expand Down
4 changes: 1 addition & 3 deletions aws/rust-runtime/aws-config/src/sts/assume_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,7 @@ mod test {
use aws_smithy_async::rt::sleep::{SharedAsyncSleep, TokioSleep};
use aws_smithy_async::test_util::instant_time_and_sleep;
use aws_smithy_async::time::StaticTimeSource;
use aws_smithy_runtime::client::http::test_util::{
capture_request, ReplayEvent, StaticReplayClient,
};
use aws_smithy_http_client::test_util::{capture_request, ReplayEvent, StaticReplayClient};
use aws_smithy_runtime::test_util::capture_test_logs::capture_test_logs;
use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
use aws_smithy_types::body::SdkBody;
Expand Down
Loading
Loading