mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-08 12:41:35 +00:00
ci: Extend virtio-net hotplug integration test
The existing virtio-net hotplug test is extended by removing and re-adding the virtio-net device. This ensures the unplug/re-plug feature is properly tested. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
8824da27cb
commit
14163c5200
@ -4947,6 +4947,35 @@ mod tests {
|
|||||||
assert!(String::from_utf8_lossy(&cmd_output)
|
assert!(String::from_utf8_lossy(&cmd_output)
|
||||||
.contains("{\"id\":\"_net2\",\"bdf\":\"0000:00:05.0\"}"));
|
.contains("{\"id\":\"_net2\",\"bdf\":\"0000:00:05.0\"}"));
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(5, 0));
|
||||||
|
|
||||||
|
// 1 network interfaces + default localhost ==> 2 interfaces
|
||||||
|
assert_eq!(
|
||||||
|
guest
|
||||||
|
.ssh_command("ip -o link | wc -l")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim()
|
||||||
|
.parse::<u32>()
|
||||||
|
.unwrap_or_default(),
|
||||||
|
2
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove network
|
||||||
|
assert!(remote_command(&api_socket, "remove-device", Some("_net2")));
|
||||||
|
thread::sleep(std::time::Duration::new(5, 0));
|
||||||
|
|
||||||
|
// Add network again
|
||||||
|
let (cmd_success, cmd_output) = remote_command_w_output(
|
||||||
|
&api_socket,
|
||||||
|
"add-net",
|
||||||
|
Some(guest.default_net_string().as_str()),
|
||||||
|
);
|
||||||
|
assert!(cmd_success);
|
||||||
|
assert!(String::from_utf8_lossy(&cmd_output)
|
||||||
|
.contains("{\"id\":\"_net3\",\"bdf\":\"0000:00:05.0\"}"));
|
||||||
|
|
||||||
|
thread::sleep(std::time::Duration::new(5, 0));
|
||||||
|
|
||||||
// 1 network interfaces + default localhost ==> 2 interfaces
|
// 1 network interfaces + default localhost ==> 2 interfaces
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
guest
|
guest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user