Skip to content

Commit 5076a5d

Browse files
committed
Fix observability detection to use type-safe downcasting and remove unused business_metrics test
1 parent 204d064 commit 5076a5d

File tree

22 files changed

+174
-57
lines changed

22 files changed

+174
-57
lines changed

aws/rust-runtime/Cargo.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/rust-runtime/aws-credential-types/src/credentials_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ mod test {
431431
"debug tester",
432432
);
433433
assert_eq!(
434-
format!("{:?}", creds),
434+
format!("{creds:?}"),
435435
r#"Credentials { provider_name: "debug tester", access_key_id: "akid", secret_access_key: "** redacted **", expires_after: "2009-02-13T23:31:30Z" }"#
436436
);
437437

@@ -445,7 +445,7 @@ mod test {
445445
.provider_name("debug tester")
446446
.build();
447447
assert_eq!(
448-
format!("{:?}", creds),
448+
format!("{creds:?}"),
449449
r#"Credentials { provider_name: "debug tester", access_key_id: "akid", secret_access_key: "** redacted **", expires_after: "2009-02-13T23:31:30Z", account_id: "012345678901" }"#
450450
);
451451
}

aws/rust-runtime/aws-inlineable/src/aws_chunked.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ mod tests {
180180
let mut file = NamedTempFile::new().unwrap();
181181

182182
for i in 0..10000 {
183-
let line = format!("This is a large file created for testing purposes {}", i);
183+
let line = format!("This is a large file created for testing purposes {i}");
184184
file.as_file_mut().write_all(line.as_bytes()).unwrap();
185185
}
186186

@@ -302,7 +302,7 @@ mod tests {
302302
async fn streaming_body(path: impl AsRef<std::path::Path>) -> SdkBody {
303303
let file = path.as_ref();
304304
ByteStream::read_from()
305-
.path(&file)
305+
.path(file)
306306
.build()
307307
.await
308308
.unwrap()

aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ mod tests {
427427
use http_body::Body;
428428
use tempfile::NamedTempFile;
429429

430+
#[allow(clippy::type_complexity)]
430431
fn create_test_interceptor() -> RequestChecksumInterceptor<
431432
impl Fn(&Input) -> (Option<String>, bool) + Send + Sync,
432433
impl Fn(&mut Request, &ConfigBag) -> Result<bool, BoxError> + Send + Sync,
@@ -449,7 +450,7 @@ mod tests {
449450

450451
let mut crc32c_checksum = checksum_algorithm.into_impl();
451452
for i in 0..10000 {
452-
let line = format!("This is a large file created for testing purposes {}", i);
453+
let line = format!("This is a large file created for testing purposes {i}");
453454
file.as_file_mut().write_all(line.as_bytes()).unwrap();
454455
crc32c_checksum.update(line.as_bytes());
455456
}
@@ -495,7 +496,7 @@ mod tests {
495496
body_data.extend_from_slice(&data.unwrap())
496497
}
497498
let body_str = std::str::from_utf8(&body_data).unwrap();
498-
let expected = format!("This is a large file created for testing purposes 9999");
499+
let expected = "This is a large file created for testing purposes 9999".to_string();
499500
assert!(
500501
body_str.ends_with(&expected),
501502
"expected '{body_str}' to end with '{expected}'"

aws/rust-runtime/aws-runtime/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async" }
2222
aws-smithy-eventstream = { path = "../../../rust-runtime/aws-smithy-eventstream", optional = true }
2323
aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" }
2424
aws-smithy-observability = { path = "../../../rust-runtime/aws-smithy-observability" }
25-
aws-smithy-observability-otel = { path = "../../../rust-runtime/aws-smithy-observability-otel" }
2625
aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime", features = ["client"] }
2726
aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] }
2827
aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" }
@@ -39,6 +38,9 @@ regex-lite = { version = "0.1.5", optional = true }
3938
tracing = "0.1.40"
4039
uuid = { version = "1" }
4140

41+
[target.'cfg(all(not(target_arch = "powerpc"), not(target_family = "wasm")))'.dependencies]
42+
aws-smithy-observability-otel = { path = "../../../rust-runtime/aws-smithy-observability-otel" }
43+
4244
[dev-dependencies]
4345
arbitrary = "1.3"
4446
aws-credential-types = { path = "../aws-credential-types", features = ["test-util"] }
@@ -52,6 +54,7 @@ futures-util = { version = "0.3.29", default-features = false }
5254
proptest = "1.2"
5355
serde = { version = "1", features = ["derive"]}
5456
serde_json = "1"
57+
serial_test = "3"
5558
tokio = { version = "1.23.1", features = ["macros", "rt", "time"] }
5659
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
5760
tracing-test = "0.2.4"

aws/rust-runtime/aws-runtime/src/endpoint_override.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ mod tests {
153153
.load::<AwsSdkFeature>()
154154
.cloned()
155155
.collect();
156-
assert_eq!(features.len(), 1, "Expected 1 feature, got: {:?}", features);
156+
assert_eq!(features.len(), 1, "Expected 1 feature, got: {features:?}");
157157
assert_eq!(features[0], AwsSdkFeature::EndpointOverride);
158158
}
159159
}

aws/rust-runtime/aws-runtime/src/env_config/section.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ mod test {
292292
let tests = fs::read_to_string("test-data/profile-parser-tests.json")?;
293293
let tests: ParserTests = serde_json::from_str(&tests)?;
294294
for (i, test) in tests.tests.into_iter().enumerate() {
295-
eprintln!("test: {}", i);
295+
eprintln!("test: {i}");
296296
check(test);
297297
}
298298
Ok(())
@@ -432,22 +432,22 @@ mod test {
432432
}
433433
}
434434
(Err(msg), ParserOutput::ErrorContaining(substr)) => {
435-
if format!("{}", msg).contains(substr) {
435+
if format!("{msg}").contains(substr) {
436436
Ok(())
437437
} else {
438-
Err(format!("Expected {} to contain {}", msg, substr))
438+
Err(format!("Expected {msg} to contain {substr}"))
439439
}
440440
}
441441
(Ok(output), ParserOutput::ErrorContaining(err)) => Err(format!(
442442
"expected an error: {err} but parse succeeded:\n{output:#?}",
443443
)),
444444
(Err(err), ParserOutput::Config { .. }) => {
445-
Err(format!("Expected to succeed but got: {}", err))
445+
Err(format!("Expected to succeed but got: {err}"))
446446
}
447447
};
448448
if let Err(e) = res {
449-
eprintln!("Test case failed: {:#?}", copy);
450-
eprintln!("failure: {}", e);
449+
eprintln!("Test case failed: {copy:#?}");
450+
eprintln!("failure: {e}");
451451
panic!("test failed")
452452
}
453453
}

aws/rust-runtime/aws-runtime/src/env_config/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ mod tests {
245245
let tests = fs::read_to_string("test-data/file-location-tests.json")?;
246246
let tests: SourceTests = serde_json::from_str(&tests)?;
247247
for (i, test) in tests.tests.into_iter().enumerate() {
248-
eprintln!("test: {}", i);
248+
eprintln!("test: {i}");
249249
check(test)
250250
.now_or_never()
251251
.expect("these futures should never poll");

0 commit comments

Comments
 (0)