From 667495cf43aea0f9ed6726edcae77e81de22ade1 Mon Sep 17 00:00:00 2001 From: "glm-5.1" Date: Fri, 12 Jun 2026 04:29:28 +0000 Subject: [PATCH] fix(logging): handle global subscriber conflict in test The init_creates_log_directory_and_file test called init() which sets a global tracing subscriber. When tests run in parallel, other tests may have already set the subscriber, causing init() to return an error and the test to fail. Now the test tolerates the 'already set' error while still asserting the log file is created. --- src/logging/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/logging/mod.rs b/src/logging/mod.rs index 5bc25d6..4ebcda3 100644 --- a/src/logging/mod.rs +++ b/src/logging/mod.rs @@ -105,8 +105,13 @@ mod tests { log_file_path: Some(log_path.to_string_lossy().to_string()), }; - let result = init(&config); - assert!(result.is_ok(), "init failed: {:?}", result.err()); + if let Err(e) = init(&config) { + let msg = format!("{e}"); + assert!( + msg.contains("global default trace dispatcher") || msg.contains("already been set"), + "unexpected init error: {e}" + ); + } assert!(log_path.exists(), "log file should be created"); } }