mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
test: add insta snapshot test for storage error display format Add snapshot test to detect unexpected changes in StorageError display format. This catches output format regressions that traditional assert tests might miss. Refs #740
This commit is contained in:
@@ -1448,4 +1448,34 @@ mod tests {
|
||||
assert_eq!(original_error, recovered_error);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_storage_error_display_snapshot() {
|
||||
// Snapshot test to detect unexpected changes in error display format
|
||||
let errors = vec![
|
||||
StorageError::BucketNotFound("test-bucket".to_string()),
|
||||
StorageError::ObjectNotFound("bucket".to_string(), "object".to_string()),
|
||||
StorageError::VersionNotFound("bucket".to_string(), "object".to_string(), "v1".to_string()),
|
||||
StorageError::InvalidUploadID("bucket".to_string(), "object".to_string(), "upload123".to_string()),
|
||||
StorageError::DiskFull,
|
||||
StorageError::FaultyDisk,
|
||||
StorageError::FileNotFound,
|
||||
StorageError::VolumeNotFound,
|
||||
StorageError::ErasureReadQuorum,
|
||||
StorageError::ErasureWriteQuorum,
|
||||
StorageError::DecommissionAlreadyRunning,
|
||||
StorageError::RebalanceAlreadyRunning,
|
||||
StorageError::OperationCanceled,
|
||||
StorageError::NamespaceLockQuorumUnavailable {
|
||||
mode: "write",
|
||||
bucket: "bucket".into(),
|
||||
object: "object".into(),
|
||||
required: 3,
|
||||
achieved: 2,
|
||||
},
|
||||
];
|
||||
|
||||
let error_messages: Vec<String> = errors.iter().map(|e| e.to_string()).collect();
|
||||
insta::assert_yaml_snapshot!("storage_error_display", error_messages);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user