From 4e3e591755adec779abb84ac36f74603fb9c6f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Fri, 14 Aug 2026 16:50:27 +0800 Subject: [PATCH] test(error): align IAM redaction expectation --- rustfs/src/error.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rustfs/src/error.rs b/rustfs/src/error.rs index 885fe8674..5819b8172 100644 --- a/rustfs/src/error.rs +++ b/rustfs/src/error.rs @@ -714,9 +714,14 @@ mod tests { let iam_error = rustfs_iam::error::Error::other("IAM test error"); let api_error: ApiError = iam_error.into(); - // IAM error is first converted to StorageError, then to ApiError - assert!(api_error.source.is_some()); - assert!(api_error.message.contains("test error")); + assert_eq!(api_error.code, S3ErrorCode::InternalError); + assert_eq!(api_error.message, ApiError::error_code_to_message(&S3ErrorCode::InternalError)); + let source = api_error + .source + .as_deref() + .and_then(|source| source.downcast_ref::()) + .expect("API error should retain the storage error source"); + assert!(matches!(source, StorageError::Io(io_error) if io_error.to_string().contains("IAM test error"))); } #[test]