in libazureinit/src/status.rs [349:375]
fn test_provisioning_skipped_on_simulated_reboot() {
let (test_config, test_dir) = create_test_config();
let mock_vm_id_path = test_dir.path().join("mock_product_uuid");
fs::write(&mock_vm_id_path, "550e8400-e29b-41d4-a716-446655440002")
.unwrap();
let vm_id = private_get_vm_id(
Some(mock_vm_id_path.to_str().unwrap()),
None,
None,
)
.unwrap();
assert!(
!is_provisioning_complete(Some(&test_config), &vm_id),
"Provisioning should NOT be complete initially"
);
mark_provisioning_complete(Some(&test_config), &vm_id).unwrap();
// Simulate a "reboot" by calling again
assert!(
is_provisioning_complete(Some(&test_config), &vm_id,),
"Provisioning should be skipped on second run (file exists)"
);
}