Unverified Commit a339f6bc authored by ysaito1001's avatar ysaito1001 Committed by GitHub
Browse files

Fix test failure in `no-default-features` (#2450)

* Fix test failure in `no-default-features`

This commit fixes a test failure from `test_clients_from_sdk_config`. It
is a negative test expecting a panic, but it failed because it panicked
for a different reason, i.e. "no default sleep implementation available."

* Avoid bringing in `rt-tokio` for `aws-smithy-async`

This commit addresses https://github.com/awslabs/smithy-rs/pull/2450#discussion_r1134426351

.

---------

Co-authored-by: default avatarYuki Saito <awsaito@amazon.com>
parent 06b865bc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ publish = false
[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 }
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async" }
futures = "0.3.25"
tokio = { version = "1.8.4", features = ["full", "test-util"] }
tracing-subscriber = { version = "0.3.15", features = ["env-filter"] }
+13 −3
Original line number Diff line number Diff line
@@ -13,12 +13,22 @@ async fn test_clients_from_sdk_config() {
}

// This will fail due to lack of a connector when constructing the service client
#[test]
#[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."
)]
fn test_clients_from_service_config() {
    let config = aws_sdk_s3::Config::builder().build();
async fn test_clients_from_service_config() {
    #[derive(Clone, Debug)]
    struct StubSleep;
    impl aws_smithy_async::rt::sleep::AsyncSleep for StubSleep {
        fn sleep(&self, _duration: std::time::Duration) -> aws_sdk_s3::config::Sleep {
            todo!()
        }
    }

    let config = aws_sdk_s3::Config::builder()
        .sleep_impl(std::sync::Arc::new(StubSleep {}))
        .build();
    // This will panic due to the lack of an HTTP connector
    aws_sdk_s3::Client::from_conf(config);
}