block: vhd: Test that resize is rejected

Fixed VHDs do not support resize. Verify the error is returned.

Assisted-by: Claude:Opus-4.6
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-04-23 00:12:08 +02:00
committed by Bo Chen
parent 8a4cd9b15d
commit 07ce8e0745

View File

@@ -125,7 +125,7 @@ mod unit_tests {
use super::*;
use crate::async_io::AsyncIo;
use crate::disk_file::{AsyncDiskFile, DiskSize};
use crate::disk_file::{AsyncDiskFile, DiskSize, Resizable};
/// Minimal fixed VHD footer (disk type = 2, current_size = 0x11223344).
fn fixed_vhd_footer() -> &'static [u8] {
@@ -204,4 +204,11 @@ mod unit_tests {
let cloned = disk.try_clone().unwrap();
assert_async_io_from_dyn(cloned.as_ref(), true);
}
#[test]
fn resize_returns_error() {
let file = make_vhd_file();
let mut disk = FixedVhdDisk::new(file, false).unwrap();
assert!(disk.resize(0x2000_0000).is_err());
}
}