11 11 | #[tokio::test]
|
12 12 | async fn using_config_loader() {
|
13 13 | // When using `aws_config::load_from_env`, things should just work
|
14 14 | let config = aws_config::load_from_env().await;
|
15 15 | assert!(config.timeout_config().unwrap().has_timeouts());
|
16 16 | assert!(config.retry_config().unwrap().has_retry());
|
17 17 | let _s3 = s3::Client::new(&config);
|
18 18 | }
|
19 19 |
|
20 20 | #[test]
|
21 21 | fn manual_config_construction_all_defaults() {
|
22 22 | // When manually constructing `SdkConfig` with everything unset,
|
23 23 | // it should work since there will be no timeouts or retries enabled,
|
24 24 | // and thus, no sleep impl is required.
|
25 25 | let config = SdkConfig::builder()
|
26 26 | .stalled_stream_protection(StalledStreamProtectionConfig::disabled())
|
27 27 | .build();
|
28 28 | assert!(config.timeout_config().is_none());
|
29 29 | assert!(config.retry_config().is_none());
|
30 30 | let _s3 = s3::Client::new(&config);
|
31 31 | }
|
32 32 |
|
33 33 | #[test]
|
34 34 | fn bytestream_from_path_exists() {
|
35 35 | let _ = aws_sdk_s3::primitives::ByteStream::from_path("a/b.txt");
|
36 36 | }
|
37 37 | }
|
38 38 |
|
39 39 | mod with_service_config {
|
40 40 | use aws_sdk_s3 as s3;
|
41 + | use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
|
41 42 |
|
42 43 | #[test]
|
43 44 | fn manual_config_construction_all_defaults() {
|
44 45 | // When manually constructing `Config` with everything unset,
|
45 46 | // it should work since there will be no timeouts or retries enabled,
|
46 47 | // and thus, no sleep impl is required.
|
47 48 | let config = s3::Config::builder().build();
|
48 49 | let _s3 = s3::Client::from_conf(config);
|
49 50 | }
|
51 + |
|
52 + | #[test]
|
53 + | #[allow(deprecated)]
|
54 + | fn test_client_with_new_behavior_version_builds_successfully() {
|
55 + | // With v2025_01_17, retries are enabled by default
|
56 + | // This test verifies the client builds without panicking about missing sleep impl
|
57 + | let config = s3::Config::builder()
|
58 + | .behavior_version(BehaviorVersion::v2025_01_17())
|
59 + | .region(aws_types::region::Region::new("us-east-1"))
|
60 + | .credentials_provider(aws_credential_types::Credentials::for_tests())
|
61 + | .build();
|
62 + |
|
63 + | // Should build successfully even though retries are enabled
|
64 + | // (sleep impl is provided by default)
|
65 + | let _client = s3::Client::from_conf(config);
|
66 + | }
|
67 + |
|
68 + | #[test]
|
69 + | #[allow(deprecated)]
|
70 + | fn test_client_with_old_behavior_version_builds_successfully() {
|
71 + | // With v2024_03_28, retries are disabled by default
|
72 + | let config = s3::Config::builder()
|
73 + | .behavior_version(BehaviorVersion::v2024_03_28())
|
74 + | .region(aws_types::region::Region::new("us-east-1"))
|
75 + | .credentials_provider(aws_credential_types::Credentials::for_tests())
|
76 + | .build();
|
77 + |
|
78 + | // Should build successfully with retries disabled
|
79 + | let _client = s3::Client::from_conf(config);
|
80 + | }
|
50 81 | }
|