mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
tests: Use wait_until() in test_pci_device_id
The SSH connection may fail initially when under load so use `wait_until()` to allow retries. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -5844,16 +5844,18 @@ mod common_parallel {
|
|||||||
}));
|
}));
|
||||||
// Calculate the succeeding device ID
|
// Calculate the succeeding device ID
|
||||||
let device_id_to_allocate = first_free_device_id + 1;
|
let device_id_to_allocate = first_free_device_id + 1;
|
||||||
// We expect the succeeding device ID to be free (single attempt, no retries)
|
// We expect the succeeding device ID to be free.
|
||||||
assert!(matches!(
|
assert!(wait_until(Duration::from_secs(10), || {
|
||||||
ssh_command_ip_with_auth(
|
matches!(
|
||||||
&format!("lspci -n | grep \"00:{device_id_to_allocate:02x}.0\""),
|
ssh_command_ip_with_auth(
|
||||||
&default_guest_auth(),
|
&format!("lspci -n | grep \"00:{device_id_to_allocate:02x}.0\""),
|
||||||
&guest.network.guest_ip0,
|
&default_guest_auth(),
|
||||||
Some(Duration::from_secs(1)),
|
&guest.network.guest_ip0,
|
||||||
),
|
Some(Duration::from_secs(5)),
|
||||||
Err(SshCommandError::NonZeroExitStatus(1))
|
),
|
||||||
));
|
Err(SshCommandError::NonZeroExitStatus(1))
|
||||||
|
)
|
||||||
|
}));
|
||||||
|
|
||||||
// Add a device to the next device slot explicitly
|
// Add a device to the next device slot explicitly
|
||||||
let (cmd_success, cmd_stdout, _) = remote_command_w_output(
|
let (cmd_success, cmd_stdout, _) = remote_command_w_output(
|
||||||
|
|||||||
Reference in New Issue
Block a user