-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix inability to create service clients when `default-features = fals…
…e` (#2055) * add: tests for config/client construction when default features are disabled fix: enable users to create service clients when default features are disabled update: missing HTTP connector panic messages * Apply suggestions from code review Co-authored-by: John DiSanti <[email protected]>
- Loading branch information
Showing
5 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ members = [ | |
"iam", | ||
"kms", | ||
"lambda", | ||
"no-default-features", | ||
"polly", | ||
"qldbsession", | ||
"s3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This Cargo.toml is unused in generated code. It exists solely to enable these tests to compile in-situ | ||
[package] | ||
name = "no-default-features" | ||
version = "0.1.0" | ||
authors = ["Zelda Hessler <[email protected]>"] | ||
description = """ | ||
These tests ensure that things will fail (or not fail) as expected | ||
when default features are disabled for all SDK and runtime crates. | ||
""" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dev-dependencies] | ||
aws-config = { path = "../../build/aws-sdk/sdk/aws-config", default-features = false } | ||
aws-sdk-s3 = { path = "../../build/aws-sdk/sdk/s3", default-features = false } | ||
futures = "0.3.25" | ||
tokio = { version = "1.8.4", features = ["full", "test-util"] } | ||
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } |
24 changes: 24 additions & 0 deletions
24
aws/sdk/integration-tests/no-default-features/tests/client-construction.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// This will fail due to lack of a connector when constructing the SDK Config | ||
#[tokio::test] | ||
#[should_panic( | ||
expected = "No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this." | ||
)] | ||
async fn test_clients_from_sdk_config() { | ||
aws_config::load_from_env().await; | ||
} | ||
|
||
// This will fail due to lack of a connector when constructing the service client | ||
#[test] | ||
#[should_panic( | ||
expected = "No HTTP connector was available. Enable the `rustls` or `native-tls` crate feature or set a connector to fix this." | ||
)] | ||
fn test_clients_from_service_config() { | ||
let config = aws_sdk_s3::Config::builder().build(); | ||
// This will panic due to the lack of an HTTP connector | ||
aws_sdk_s3::Client::from_conf(config); | ||
} |