tests: Ensure that virtiofsd has exited before hotplugging

Fix test flakiness where the virtiofsd daemon was still running and
hotplugging was trying to reach the old version. Cleanup the socket so
that waiting for it actually waits for the new instance.

Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-04-20 12:21:25 +01:00
parent 926dd1e141
commit a77b6231b4

View File

@@ -1060,6 +1060,11 @@ pub(crate) fn _test_virtio_fs(
});
let (r, hotplug_daemon_child) = if r.is_ok() && hotplug {
let _ = daemon_child.kill();
let _ = daemon_child.wait();
// Remove the stale socket so wait_for_virtiofsd_socket actually waits
let _ = std::fs::remove_file(&virtiofsd_socket_path);
let (daemon_child, virtiofsd_socket_path) =
prepare_daemon(&guest.tmp_dir, shared_dir.to_str().unwrap());