mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 23:47:28 +00:00
fix(ecstore): map missing metadata to not found (#2944)
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -5559,6 +5559,36 @@ mod tests {
|
||||
assert_eq!(result, None); // No UUID meets quorum of 2
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_object_quorum_from_meta_returns_not_found_when_all_metadata_is_missing() {
|
||||
let errs = vec![
|
||||
Some(DiskError::FileNotFound),
|
||||
Some(DiskError::VolumeNotFound),
|
||||
Some(DiskError::DiskNotFound),
|
||||
Some(DiskError::FileNotFound),
|
||||
];
|
||||
|
||||
let err = SetDisks::object_quorum_from_meta(&vec![FileInfo::default(); errs.len()], &errs, 2)
|
||||
.expect_err("missing metadata should map to FileNotFound");
|
||||
|
||||
assert_eq!(err, DiskError::FileNotFound);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_object_quorum_from_meta_preserves_read_quorum_for_mixed_failures() {
|
||||
let errs = vec![
|
||||
Some(DiskError::FileNotFound),
|
||||
Some(DiskError::VolumeNotFound),
|
||||
Some(DiskError::FileCorrupt),
|
||||
Some(DiskError::DiskNotFound),
|
||||
];
|
||||
|
||||
let err = SetDisks::object_quorum_from_meta(&vec![FileInfo::default(); errs.len()], &errs, 2)
|
||||
.expect_err("mixed metadata failures should keep quorum semantics");
|
||||
|
||||
assert_eq!(err, DiskError::ErasureReadQuorum);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shuffle_parts_metadata() {
|
||||
// Test metadata shuffling
|
||||
|
||||
Reference in New Issue
Block a user