mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: factory: Add test for readonly open
Verify that open_disk() succeeds with readonly=true on a RAW image. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
78784c2a3f
commit
37693aa141
@@ -251,4 +251,15 @@ mod unit_tests {
|
||||
let opened = open_disk(&options).unwrap();
|
||||
assert_eq!(opened.image_type, ImageType::Qcow2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_readonly() {
|
||||
let tmp = TempFile::new().unwrap();
|
||||
tmp.as_file().set_len(1 << 20).unwrap();
|
||||
let path = tmp.as_path().to_owned();
|
||||
let mut options = default_options(&path);
|
||||
options.readonly = true;
|
||||
let opened = open_disk(&options).unwrap();
|
||||
assert_eq!(opened.image_type, ImageType::Raw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user