From 2f58fb8307dbee4fdac382774a7b00a9e72e0982 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 27 Feb 2020 13:54:05 +0000 Subject: [PATCH] tests: Test rebooting works for block self spawn test Being able to reboot the VM is an important aspect of the self spawning behaviour. Signed-off-by: Rob Bradford --- tests/integration.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index cd13c58d2..bb282fc13 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -1380,8 +1380,25 @@ mod tests { thread::sleep(std::time::Duration::new(20, 0)); - guest.ssh_command("sudo shutdown -h now")?; - thread::sleep(std::time::Duration::new(5, 0)); + let reboot_count = guest + .ssh_command("sudo journalctl | grep -c -- \"-- Reboot --\"") + .unwrap_or_default() + .trim() + .parse::() + .unwrap_or(1); + + aver_eq!(tb, reboot_count, 0); + guest.ssh_command("sudo reboot").unwrap_or_default(); + + thread::sleep(std::time::Duration::new(20, 0)); + let reboot_count = guest + .ssh_command("sudo journalctl | grep -c -- \"-- Reboot --\"") + .unwrap_or_default() + .trim() + .parse::() + .unwrap_or_default(); + aver_eq!(tb, reboot_count, 1); + let _ = cloud_child.kill(); let _ = cloud_child.wait();