test(ecstore): cover system path failure classifier (#2874)

This commit is contained in:
安正超
2026-05-08 22:51:11 +08:00
committed by GitHub
parent c90bfe2b23
commit 5081b8396d
+22
View File
@@ -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