block: vhd: Test that try_clone preserves backend dispatch

Verify that a cloned disk produces the same async I/O backend
as the original for both sync and io_uring paths.

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

View File

@@ -187,4 +187,21 @@ mod unit_tests {
let disk = FixedVhdDisk::new(file, true).unwrap();
assert_async_io(&disk, true);
}
#[test]
fn try_clone_preserves_sync_dispatch() {
let file = make_vhd_file();
let disk = FixedVhdDisk::new(file, false).unwrap();
let cloned = disk.try_clone().unwrap();
assert_async_io_from_dyn(cloned.as_ref(), false);
}
#[cfg(feature = "io_uring")]
#[test]
fn try_clone_preserves_io_uring_dispatch() {
let file = make_vhd_file();
let disk = FixedVhdDisk::new(file, true).unwrap();
let cloned = disk.try_clone().unwrap();
assert_async_io_from_dyn(cloned.as_ref(), true);
}
}