#[cfg(target_os = "linux")]
use wireguard_uapi::set;
#[cfg(target_os = "linux")]
use wireguard_uapi::WgSocket;
#[cfg(target_os = "linux")]
#[test]
fn missing_device_returns_sensible_error() -> anyhow::Result<()> {
let mut wg = WgSocket::connect()?;
let ifname = "wg404";
let set_device_args = set::Device::from_ifname(ifname)
.flags(vec![set::WgDeviceF::ReplacePeers])
.peers(vec![]);
let set_device_result = wg.set_device(set_device_args);
let existing_err_message = set_device_result.unwrap_err().to_string();
assert!(
existing_err_message.starts_with("Error response received from netlink: No such device")
);
Ok(())
}