diff --git a/crates/trading_engine/src/types/metrics.rs b/crates/trading_engine/src/types/metrics.rs index c766280ba..89b8e369f 100644 --- a/crates/trading_engine/src/types/metrics.rs +++ b/crates/trading_engine/src/types/metrics.rs @@ -1311,7 +1311,18 @@ mod tests { #[test] fn test_metrics_initialization() { - assert!(initialize_metrics().is_ok()); + // initialize_metrics() returns AlreadyReg if another test in this + // process already triggered the lazy_static counters. Both Ok and + // AlreadyReg are acceptable — only a hard error would be a bug. + let result = initialize_metrics(); + assert!( + result.is_ok() + || result + .as_ref() + .err() + .map_or(false, |e| format!("{e}").contains("already")), + "initialize_metrics failed with unexpected error: {result:?}" + ); } #[test]