From 01decd964f224b7fd626eab639652204eecbe318 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 15 Apr 2026 09:16:37 +0100 Subject: [PATCH] tests: Remove explicit sleep from tests_simple_launch tests On the shutdown path remove the explicit sleep and instead wait for the event to be delivered. Signed-off-by: Rob Bradford --- cloud-hypervisor/tests/common/tests_wrappers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloud-hypervisor/tests/common/tests_wrappers.rs b/cloud-hypervisor/tests/common/tests_wrappers.rs index f1f41ecb9..4d2b45284 100644 --- a/cloud-hypervisor/tests/common/tests_wrappers.rs +++ b/cloud-hypervisor/tests/common/tests_wrappers.rs @@ -1604,7 +1604,6 @@ pub(crate) fn _test_simple_launch(guest: &Guest) { let _ = guest.ssh_command("sudo systemctl stop snapd"); guest.ssh_command("sudo poweroff").unwrap(); - thread::sleep(std::time::Duration::new(20, 0)); let latest_events = [ &MetaEvent { event: "shutdown".to_string(), @@ -1619,7 +1618,9 @@ pub(crate) fn _test_simple_launch(guest: &Guest) { device_id: None, }, ]; - assert!(check_latest_events_exact(&latest_events, &event_path)); + assert!(wait_until(Duration::from_secs(20), || { + check_latest_events_exact(&latest_events, &event_path) + })); }); kill_child(&mut child);