Skip to content

Commit 81a4eb7

Browse files
committed
fix: resolve dfe test failures and advisory warnings
- Change dfe::tests to #[tokio::test] (MetricsManager::new needs a reactor when all-features enabled via hyper-util) - Fix clippy cast warnings in worker_test.rs - Add deny.toml ignore rules for unmaintained transitive deps (instant via reqwest-retry, paste via dtolnay)
1 parent dd2f0aa commit 81a4eb7

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

deny.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ all-features = true
44

55
[advisories]
66
yanked = "warn"
7+
# Transitive deps we cannot control — track upstream for resolution
8+
ignore = [
9+
"RUSTSEC-2024-0384", # instant (via reqwest-retry → parking_lot 0.11)
10+
"RUSTSEC-2024-0436", # paste (dtolnay crate, widely used, no replacement)
11+
]
712

813
[licenses]
914
allow = [

src/metrics/dfe.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,14 @@ impl DfeMetrics {
511511
mod tests {
512512
use super::*;
513513

514-
#[test]
515-
fn test_register_does_not_panic() {
514+
#[tokio::test]
515+
async fn test_register_does_not_panic() {
516516
let mgr = super::super::MetricsManager::new("test_app");
517517
let _dfe = DfeMetrics::register(&mgr);
518518
}
519519

520-
#[test]
521-
fn test_register_populates_registry() {
520+
#[tokio::test]
521+
async fn test_register_populates_registry() {
522522
let mgr = super::super::MetricsManager::new("test_app");
523523
let _dfe = DfeMetrics::register(&mgr);
524524
let manifest = mgr.registry().manifest();
@@ -549,8 +549,8 @@ mod tests {
549549
assert_eq!(auth.labels, vec!["reason"]);
550550
}
551551

552-
#[test]
553-
fn test_methods_callable_without_recorder() {
552+
#[tokio::test]
553+
async fn test_methods_callable_without_recorder() {
554554
let mgr = super::super::MetricsManager::new("test_app");
555555
let dfe = DfeMetrics::register(&mgr);
556556

tests/worker_test.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn test_process_batch_executes_on_multiple_threads() {
8383
for (i, result) in results.iter().enumerate() {
8484
assert_eq!(
8585
*result.as_ref().unwrap(),
86-
(i as i32) * 2,
86+
(i32::try_from(i).unwrap()) * 2,
8787
"Wrong result at index {i}"
8888
);
8989
}
@@ -171,7 +171,10 @@ async fn test_fan_out_async_preserves_order() {
171171
let items: Vec<i32> = (0..20).collect();
172172
let results: Vec<Result<i32, String>> = pool
173173
.fan_out_async(&items, |&item| async move {
174-
tokio::time::sleep(std::time::Duration::from_millis((20 - item as u64) % 10)).await;
174+
tokio::time::sleep(std::time::Duration::from_millis(
175+
u64::try_from(20 - item).unwrap_or(0) % 10,
176+
))
177+
.await;
175178
Ok(item * 3)
176179
})
177180
.await;
@@ -180,7 +183,7 @@ async fn test_fan_out_async_preserves_order() {
180183
for (i, result) in results.iter().enumerate() {
181184
assert_eq!(
182185
*result.as_ref().unwrap(),
183-
(i as i32) * 3,
186+
(i32::try_from(i).unwrap()) * 3,
184187
"Result at index {i} has wrong value"
185188
);
186189
}

0 commit comments

Comments
 (0)