From 5081b8396d1eadf8db37197f46c66ec0fe07de37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Fri, 8 May 2026 22:51:11 +0800 Subject: [PATCH] test(ecstore): cover system path failure classifier (#2874) --- crates/ecstore/src/error.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/ecstore/src/error.rs b/crates/ecstore/src/error.rs index 504f33570..e20d1e6be 100644 --- a/crates/ecstore/src/error.rs +++ b/crates/ecstore/src/error.rs @@ -1036,6 +1036,28 @@ mod tests { assert!(!is_err_not_initialized(&StorageError::DecommissionAlreadyRunning)); } + #[test] + fn test_classify_system_path_failure_reason() { + assert_eq!(classify_system_path_failure_reason(&StorageError::ConfigNotFound), "config_not_found"); + assert_eq!(classify_system_path_failure_reason(&StorageError::ErasureReadQuorum), "read_quorum"); + assert_eq!( + classify_system_path_failure_reason(&StorageError::InsufficientReadQuorum( + "bucket".to_string(), + "object".to_string() + )), + "read_quorum" + ); + assert_eq!( + classify_system_path_failure_reason(&StorageError::Io(IoError::new(ErrorKind::TimedOut, "probe"))), + "timeout" + ); + assert_eq!( + classify_system_path_failure_reason(&StorageError::Io(IoError::new(ErrorKind::PermissionDenied, "probe"))), + "io" + ); + assert_eq!(classify_system_path_failure_reason(&StorageError::DiskFull), "other"); + } + #[test] fn test_storage_error_from_disk_error() { // Test conversion from DiskError