Skip to content

Commit 2246dfb

Browse files
committed
Add tests for v2025_01_17 retry and timeout defaults
1 parent fc83a75 commit 2246dfb

3 files changed

Lines changed: 56 additions & 6 deletions

File tree

aws/sdk/integration-tests/s3/tests/client_construction.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ mod with_service_config {
4040
use aws_sdk_s3 as s3;
4141

4242
#[test]
43+
#[allow(deprecated)]
4344
fn manual_config_construction_all_defaults() {
44-
// When manually constructing `Config` with everything unset,
45-
// it should work since there will be no timeouts or retries enabled,
45+
// When manually constructing `Config` with everything unset and using an older
46+
// behavior version, it should work since there will be no timeouts or retries enabled,
4647
// and thus, no sleep impl is required.
47-
let config = s3::Config::builder().build();
48+
let config = s3::Config::builder()
49+
.behavior_version(
50+
aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::v2024_03_28(),
51+
)
52+
.build();
4853
let _s3 = s3::Client::from_conf(config);
4954
}
5055
}

rust-runtime/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/aws-smithy-runtime/src/client/defaults.rs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn default_retry_config_plugin(
148148
}
149149

150150
/// Runtime plugin that sets the default retry strategy, config, and partition.
151-
///
151+
///
152152
/// This version respects the behavior version to enable retries by default for newer versions.
153153
pub fn default_retry_config_plugin_v2(
154154
default_partition_name: impl Into<Cow<'static, str>>,
@@ -213,7 +213,7 @@ pub fn default_timeout_config_plugin() -> Option<SharedRuntimePlugin> {
213213
}
214214

215215
/// Runtime plugin that sets the default timeout config.
216-
///
216+
///
217217
/// This version respects the behavior version to enable connection timeout by default for newer versions.
218218
pub fn default_timeout_config_plugin_v2(
219219
behavior_version: BehaviorVersion,
@@ -437,4 +437,49 @@ mod tests {
437437
"stalled stream protection on uploads MUST NOT be enabled before v2024_03_28"
438438
);
439439
}
440+
441+
#[test]
442+
#[allow(deprecated)]
443+
fn v2025_01_17_retry_config_enabled_by_default() {
444+
let latest = config_for(default_plugins(test_plugin_params(
445+
BehaviorVersion::latest(),
446+
)));
447+
let v2024 = config_for(default_plugins(test_plugin_params(
448+
BehaviorVersion::v2024_03_28(),
449+
)));
450+
451+
assert!(
452+
latest.load::<RetryConfig>().unwrap().has_retry(),
453+
"retries MUST be enabled by default for v2025_01_17 and later"
454+
);
455+
assert!(
456+
!v2024.load::<RetryConfig>().unwrap().has_retry(),
457+
"retries MUST be disabled by default before v2025_01_17"
458+
);
459+
}
460+
461+
#[test]
462+
#[allow(deprecated)]
463+
fn v2025_01_17_connection_timeout_enabled_by_default() {
464+
let latest = config_for(default_plugins(test_plugin_params(
465+
BehaviorVersion::latest(),
466+
)));
467+
let v2024 = config_for(default_plugins(test_plugin_params(
468+
BehaviorVersion::v2024_03_28(),
469+
)));
470+
471+
let latest_timeout = latest.load::<TimeoutConfig>().unwrap();
472+
assert_eq!(
473+
latest_timeout.connect_timeout(),
474+
Some(Duration::from_millis(3100)),
475+
"connection timeout MUST be 3.1s by default for v2025_01_17 and later"
476+
);
477+
478+
let v2024_timeout = v2024.load::<TimeoutConfig>().unwrap();
479+
assert_eq!(
480+
v2024_timeout.connect_timeout(),
481+
None,
482+
"connection timeout MUST be disabled by default before v2025_01_17"
483+
);
484+
}
440485
}

0 commit comments

Comments
 (0)