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 <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-15 09:16:37 +01:00
parent f55a90c170
commit 01decd964f

View File

@@ -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);