seaweed-volume: run the preallocating max-volume test on a fake disk (#12423)

* seaweed-volume: run the preallocating max-volume test on a fake disk

The test sized the volume limit from the real free space but the store
subtracts the 1% floor first, so on a disk more than 95% full the second
slot no longer fit and the count came out 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* seaweed-volume: start the preallocating max-volume test above the expected count

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-05 02:03:07 -08:00
1 parent b74111ea2f
commit 85232f7414
1 file changed
+9 -10
+9 -10
View File
@@ -3064,6 +3064,7 @@ mod tests {
#[test]
fn test_maybe_adjust_volume_max_reserves_plain_volumes_while_preallocating() {
let _g = FAKE_DISK_LOCK.lock().unwrap();
let tmp = TempDir::new().unwrap();
let dir = tmp.path().to_str().unwrap();
@@ -3072,7 +3073,7 @@ mod tests {
.add_location(
dir,
dir,
2,
5,
DiskType::HardDrive,
MinFreeSpace::Percent(1.0),
Vec::new(),
@@ -3089,15 +3090,13 @@ mod tests {
)
.unwrap();
// Room for 2.5 volumes: the plain volume claims one, leaving one more slot.
let (_, free) = crate::storage::disk_location::get_disk_stats(dir);
let volume_size_limit = (free as f64 / 2.5) as u64;
if volume_size_limit == 0 {
return; // cannot determine free disk space
}
store
.volume_size_limit
.store(volume_size_limit, Ordering::Relaxed);
// Room for 2.5 volumes above the 1% floor: the plain volume claims one,
// leaving one more slot.
let limit = 1024 * MIB;
FAKE_ALL.store(100 * limit, Ordering::Relaxed);
FAKE_FREE.store(limit + limit * 5 / 2, Ordering::Relaxed);
store.disk_stats_of = fake_disk_stats;
store.volume_size_limit.store(limit, Ordering::Relaxed);
store.locations[0].original_max_volume_count = 0;
store.set_preallocate(true);