From 10db4150990a906b5d5881ce988dc2ac59ee578b Mon Sep 17 00:00:00 2001 From: overtrue Date: Wed, 29 Jul 2026 00:21:27 +0800 Subject: [PATCH] test(ecstore): give the read-version quorum fixture a valid part MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `read_version_quorum_test_set` (#5365) writes `valid_test_fileinfo` to disk before exercising the optimized version read. That fixture deliberately carries a positive size with no parts so it can drive `get_object_with_fileinfo_rejects_positive_size_without_parts`, and #5354 subsequently taught `validate_collection_contents` to reject exactly that shape as `FileCorrupt`. #5354 fixed up the fixtures that existed when it landed, but #5365 was developed in parallel and its new fixture was not, so `write_metadata` now fails in the helper and both `read_version_optimized_counts_only_valid_metadata_toward_quorum` and `read_version_optimized_uses_current_set_drive_quorum_not_pool_set_count` panic on `metadata should be written before quorum read: FileCorrupt`. Neither PR could see the break on its own; it only appears once both are on main, where it fails the Test and Lint lane deterministically for every PR. Push a part matching the fixture's size in the helper — the same fix #5354 applied to its own on-disk fixture in `disk/local.rs` — instead of changing `valid_test_fileinfo`, which must stay part-less for the rejection test. Verification: - cargo test -p rustfs-ecstore --lib set_disk::read::metadata_cache_tests (previously 2 failed, now 33 passed / 0 failed) - cargo fmt --all --check and cargo clippy -p rustfs-ecstore --lib --tests clean --- crates/ecstore/src/set_disk/read.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ecstore/src/set_disk/read.rs b/crates/ecstore/src/set_disk/read.rs index 64369b5d5..a15a193c5 100644 --- a/crates/ecstore/src/set_disk/read.rs +++ b/crates/ecstore/src/set_disk/read.rs @@ -1971,6 +1971,17 @@ mod metadata_cache_tests { let mut fi = valid_test_fileinfo(object); fi.mod_time = Some(OffsetDateTime::now_utc()); fi.erasure.index = fi.erasure.distribution[disk_index]; + // `valid_test_fileinfo` carries a positive size with no parts — + // the shape `validate_collection_contents` rejects as + // `FileCorrupt` — so it can drive + // `get_object_with_fileinfo_rejects_positive_size_without_parts`. + // Metadata that has to survive a write needs the matching part. + fi.parts.push(ObjectPartInfo { + number: 1, + size: 1, + actual_size: 1, + ..Default::default() + }); disk.write_metadata(bucket, bucket, object, fi) .await .expect("metadata should be written before quorum read");