Skip to content

Commit

Permalink
update feature flags based on feedback and discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
aajtodd committed Dec 12, 2024
1 parent 76923e9 commit 2ac6c28
Show file tree
Hide file tree
Showing 26 changed files with 108 additions and 52 deletions.
62 changes: 57 additions & 5 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.

2 changes: 1 addition & 1 deletion aws/rust-runtime/aws-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ proc-macro2 = {version = "1.0.92", optional = true }

[dev-dependencies]
aws-smithy-async = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-async", features = ["rt-tokio", "test-util"] }
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util-latest"] }
aws-smithy-runtime = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] }
aws-smithy-http-client = { path = "../../sdk/build/aws-sdk/sdk/aws-smithy-http-client", features = ["hyper-1", "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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class IntegrationTestDependencies(
addDependency(SerdeJson)
addDependency(smithyAsync)
addDependency(smithyProtocolTestHelpers(codegenContext.runtimeConfig))
addDependency(smithyRuntime(runtimeConfig).copy(features = setOf("test-util-latest"), scope = DependencyScope.Dev))
addDependency(smithyRuntime(runtimeConfig).copy(features = setOf("test-util"), scope = DependencyScope.Dev))
addDependency(smithyRuntimeApiTestUtil(runtimeConfig))
addDependency(smithyTypes)
addDependency(Tokio)
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/benchmarks/previous-release-comparison/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
aws-config = { path = "../../build/aws-sdk/sdk/aws-config" }
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
aws-sdk-s3 = { path = "../../build/aws-sdk/sdk/s3" }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util"] }
criterion = { version = "0.5", features = ["async_tokio"] }
http = "0.2.3"
previous-s3 = { version = "1", package = "aws-sdk-s3", features = ["test-util"] }
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/dynamodb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ aws-sdk-dynamodb = { path = "../../build/aws-sdk/sdk/dynamodb", features = ["beh
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", features = ["test-util"] }
aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" }
aws-smithy-protocol-test = { path = "../../build/aws-sdk/sdk/aws-smithy-protocol-test" }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] }
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", features = ["test-util", "wire-mock"] }
aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["test-util"]}
aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types", features = ["test-util"]}
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/ec2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publish = false
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
aws-runtime = { path = "../../build/aws-sdk/sdk/aws-runtime", features = ["test-util"] }
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", features = ["test-util"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["client", "test-util"] }
# TODO(hyper1) - remove legacy-test-util feature by providing an http 1.x answer to take_requests() function
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", features = ["test-util", "legacy-test-util"] }
aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["client", "http-1x"] }
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/no-default-features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish = false
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" }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util"] }
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", features = ["test-util"] }
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
futures = "0.3.25"
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/s3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ aws-sdk-s3 = { path = "../../build/aws-sdk/sdk/s3", features = ["test-util", "be
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", features = ["test-util", "rt-tokio"] }
aws-smithy-http = { path = "../../build/aws-sdk/sdk/aws-smithy-http" }
aws-smithy-protocol-test = { path = "../../build/aws-sdk/sdk/aws-smithy-protocol-test" }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util"] }
aws-smithy-runtime-api = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime-api", features = ["test-util", "http-1x"] }
aws-smithy-types = { path = "../../build/aws-sdk/sdk/aws-smithy-types" }
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", features = ["hyper-1", "rustls-ring", "test-util", "wire-mock"] }
Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/timestreamquery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ publish = false
aws-credential-types = { path = "../../build/aws-sdk/sdk/aws-credential-types", features = ["test-util"] }
aws-sdk-timestreamquery = { path = "../../build/aws-sdk/sdk/timestreamquery", features = ["behavior-version-latest"] }
aws-smithy-async = { path = "../../build/aws-sdk/sdk/aws-smithy-async", features = ["test-util"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util-latest"] }
aws-smithy-runtime = { path = "../../build/aws-sdk/sdk/aws-smithy-runtime", features = ["test-util"] }
aws-smithy-http-client = { path = "../../build/aws-sdk/sdk/aws-smithy-http-client", features = ["test-util"] }
aws-types = { path = "../../build/aws-sdk/sdk/aws-types" }
tokio = { version = "1.23.1", features = ["full", "test-util"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class ServiceGenerator(
)
serviceConfigGenerator.render(this)

// Enable users to opt in to the `test-util-latest` feature in the runtime crate
rustCrate.mergeFeature(TestUtilFeature.copy(deps = listOf("aws-smithy-runtime/test-util-latest")))
// Enable users to opt in to the `test-util` feature in the runtime crate
rustCrate.mergeFeature(TestUtilFeature.copy(deps = listOf("aws-smithy-runtime/test-util")))

ServiceRuntimePluginGenerator(codegenContext)
.render(this, decorator.serviceRuntimePluginCustomizations(codegenContext, emptyList()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ fun InlineDependency.toType() = RuntimeType(module.fullyQualifiedPath(), this)

data class Feature(val name: String, val default: Boolean, val deps: List<String>)

val DEV_ONLY_FEATURES = setOf("test-util", "test-util-latest")
val DEV_ONLY_FEATURES = setOf("test-util", "legacy-test-util")

/**
* A dependency on an internal or external Cargo crate
Expand Down Expand Up @@ -380,7 +380,7 @@ data class CargoDependency(
.withFeature("client")

fun smithyRuntimeTestUtil(runtimeConfig: RuntimeConfig) =
smithyRuntime(runtimeConfig).toDevDependency().withFeature("test-util-latest")
smithyRuntime(runtimeConfig).toDevDependency().withFeature("test-util")

fun smithyRuntimeApi(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-runtime-api")

Expand Down
24 changes: 14 additions & 10 deletions rust-runtime/aws-smithy-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,28 @@ rt-tokio = ["tokio/rt"]

# Features for testing
# NOTE: `test-util` originally enabled the HTTP related test utils which have since been relocated to `aws-smithy-http-client`
# and updated to work with the 1.x HTTP/hyper ecosystem. Feature remains in place for backwards compat but internal
# usage should rely on `test-util-latest` to avoid pulling in all of pre 1.x hyper ecosystem.
# Same thing for `wire-mock`, prefer using the `aws-smithy-http-client/wire-mock` feature directly instead.
# and updated to work with the 1.x HTTP/hyper ecosystem. Prefer using the `test-util` and `wire-mock` features from
# `aws-smithy-http-client` directly instead for HTTP test utils.
test-util = [
"test-util-latest",
# legacy http test utils
"connector-hyper-0-14-x",
"aws-smithy-http-client/legacy-test-util",
"aws-smithy-runtime-api/test-util",
"dep:tracing-subscriber",
"aws-smithy-http-client/test-util",
# TODO(hyper1): Feature remains in place for backwards compat but in a future release we will break this flag and disable legacy HTTP test utils
"legacy-test-util",
]

wire-mock = ["test-util", "aws-smithy-http-client/wire-mock"]

test-util-latest = [
legacy-test-util = [
# non HTTP test utils
"aws-smithy-runtime-api/test-util",
"dep:tracing-subscriber",
"aws-smithy-http-client/test-util",
# legacy http test utils
"connector-hyper-0-14-x",
"aws-smithy-http-client/legacy-test-util",
]

wire-mock = ["legacy-test-util", "aws-smithy-http-client/wire-mock"]

[dependencies]
aws-smithy-async = { path = "../aws-smithy-async" }
aws-smithy-http = { path = "../aws-smithy-http" }
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-runtime/additional-ci
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ set -e

echo "### Testing every combination of features (excluding --all-features)"
# Skip deprecated features that are re-exported from `aws-smithy-http-client` (and tested there already)
cargo hack test --feature-powerset --exclude-all-features --exclude-features test-util,wire-mock,connector-hyper-0-14-x,tls-rustls
cargo hack test --feature-powerset --exclude-all-features --exclude-features legacy-test-util,wire-mock,connector-hyper-0-14-x,tls-rustls
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-runtime/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub mod retries;
/// Utilities for testing orchestrators. An orchestrator missing required components will panic when
/// run. This module contains stub components that can be used when you only care about testing some
/// specific aspect of the orchestrator.
#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
pub mod test_util;

mod timeout;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl RuntimePlugin for EnforceContentLengthRuntimePlugin {
}
}

#[cfg(all(test, any(feature = "test-util-latest", feature = "test-util")))]
#[cfg(all(test, any(feature = "test-util", feature = "legacy-test-util")))]
mod test {
use crate::assert_str_contains;
use crate::client::http::body::content_length_enforcement::{
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-runtime/src/client/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ async fn finally_op(
});
}

#[cfg(all(test, any(feature = "test-util-latest", feature = "test-util")))]
#[cfg(all(test, any(feature = "test-util", feature = "legacy-test-util")))]
mod tests {
use crate::client::auth::no_auth::{NoAuthRuntimePlugin, NO_AUTH_SCHEME_ID};
use crate::client::orchestrator::endpoints::StaticUriEndpointResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl fmt::Debug for ExploredList {
}
}

#[cfg(all(test, any(feature = "test-util-latest", feature = "test-util")))]
#[cfg(all(test, any(feature = "test-util", feature = "legacy-test-util")))]
mod tests {
use super::*;
use aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ impl<I, O, E> OperationBuilder<I, O, E> {
}
}

#[cfg(all(test, any(feature = "test-util-latest", feature = "test-util")))]
#[cfg(all(test, any(feature = "test-util", feature = "legacy-test-util")))]
mod tests {
use super::*;
use crate::client::retries::classifiers::HttpStatusCodeClassifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ mod tests {
use aws_smithy_types::retry::{ErrorKind, RetryConfig};

use super::{calculate_exponential_backoff, StandardRetryStrategy};
#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
use crate::client::retries::TokenBucket;

#[test]
Expand Down Expand Up @@ -468,7 +468,7 @@ mod tests {
retry_actions: Mutex<Vec<RetryAction>>,
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
impl PresetReasonRetryClassifier {
fn new(mut retry_reasons: Vec<RetryAction>) -> Self {
// We'll pop the retry_reasons in reverse order, so we reverse the list to fix that.
Expand Down Expand Up @@ -502,7 +502,7 @@ mod tests {
}
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
fn setup_test(
retry_reasons: Vec<RetryAction>,
retry_config: RetryConfig,
Expand All @@ -523,7 +523,7 @@ mod tests {
(cfg, rc, ctx)
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn eventual_success() {
let (mut cfg, rc, mut ctx) = setup_test(
Expand Down Expand Up @@ -556,7 +556,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 495);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn no_more_attempts() {
let (mut cfg, rc, ctx) = setup_test(
Expand Down Expand Up @@ -587,7 +587,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 490);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn successful_request_and_deser_should_be_retryable() {
#[derive(Clone, Copy, Debug)]
Expand Down Expand Up @@ -679,7 +679,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 5);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn no_quota() {
let (mut cfg, rc, ctx) = setup_test(
Expand All @@ -704,7 +704,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 0);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn quota_replenishes_on_success() {
let (mut cfg, rc, mut ctx) = setup_test(
Expand Down Expand Up @@ -744,7 +744,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 100);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn quota_replenishes_on_first_try_success() {
const PERMIT_COUNT: usize = 20;
Expand Down Expand Up @@ -798,7 +798,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), PERMIT_COUNT);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn backoff_timing() {
let (mut cfg, rc, ctx) = setup_test(
Expand Down Expand Up @@ -841,7 +841,7 @@ mod tests {
assert_eq!(token_bucket.available_permits(), 480);
}

#[cfg(any(feature = "test-util-latest", feature = "test-util"))]
#[cfg(any(feature = "test-util", feature = "legacy-test-util"))]
#[test]
fn max_backoff_time() {
let (mut cfg, rc, ctx) = setup_test(
Expand Down
Loading

0 comments on commit 2ac6c28

Please sign in to comment.