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 <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-02-27 13:54:05 +00:00
parent e817aa6824
commit 2f58fb8307

View File

@ -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::<u32>()
.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::<u32>()
.unwrap_or_default();
aver_eq!(tb, reboot_count, 1);
let _ = cloud_child.kill();
let _ = cloud_child.wait();