From 07ce8e07450319ceb621cb837bfc481c58121160 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 23 Apr 2026 00:12:08 +0200 Subject: [PATCH] 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 --- block/src/fixed_vhd_disk.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/block/src/fixed_vhd_disk.rs b/block/src/fixed_vhd_disk.rs index 5d6258636..f5c6e9547 100644 --- a/block/src/fixed_vhd_disk.rs +++ b/block/src/fixed_vhd_disk.rs @@ -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()); + } }