tests: Fix test_virtio_balloon_deflate_on_oom()

It might sometimes take a few seconds for the guest to trigger the OOM
and report it back to the host. That's why this patch adds some sleep
time between the command in the guest supposedly triggering the OOM and
the check of the balloon size from the host.

Fixes #4336

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-07-21 11:16:55 +02:00 committed by Rob Bradford
parent 0bb509e5d2
commit ec27e0ee82

View File

@ -5069,6 +5069,10 @@ mod parallel {
.ssh_command("stress --vm 25 --vm-keep --vm-bytes 1G --timeout 20")
.unwrap();
// Give some time for the OOM to happen in the guest and be reported
// back to the host.
thread::sleep(std::time::Duration::new(20, 0));
// 2nd: check balloon_mem's value to verify balloon has been automatically deflated
let deflated_balloon = balloon_size(&api_socket);
println!(