From 82628b8a7828507617a430e6875f1e25d5c211ef Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 24 Sep 2024 08:34:17 +0200 Subject: [PATCH] metrics: don't hang in injection_queue_depth_multi_thread test (#6862) --- tokio/tests/rt_metrics.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tokio/tests/rt_metrics.rs b/tokio/tests/rt_metrics.rs index 9d42b416608..e2494cf5e64 100644 --- a/tokio/tests/rt_metrics.rs +++ b/tokio/tests/rt_metrics.rs @@ -83,12 +83,21 @@ fn injection_queue_depth_multi_thread() { barrier1.wait(); + let mut fail: Option = None; for i in 0..10 { - assert_eq!(i, metrics.injection_queue_depth()); + let depth = metrics.injection_queue_depth(); + if i != depth { + fail = Some(format!("{i} is not equal to {depth}")); + break; + } rt.spawn(async {}); } barrier2.wait(); + + if let Some(fail) = fail { + panic!("{fail}"); + } } fn current_thread() -> Runtime {