From de38e4b77787ec68f94de3eaf82be50722a91e77 Mon Sep 17 00:00:00 2001 From: Songqian Li Date: Tue, 14 May 2024 20:11:31 +0800 Subject: [PATCH] tests: restart systemd daemon to reload systemd configuration Currently, the watchdog configuration in systemd is reloaded by reboot. We can cancel this reboot operation by restarting the systemd daemon process. Signed-off-by: Songqian Li --- tests/integration.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index 8f61c1730..b30e5a3b4 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -2331,6 +2331,8 @@ fn enable_guest_watchdog(guest: &Guest, watchdog_sec: u32) { "echo RuntimeWatchdogSec={watchdog_sec}s | sudo tee -a /etc/systemd/system.conf" )) .unwrap(); + + guest.ssh_command("sudo systemctl daemon-reexec").unwrap(); } fn make_guest_panic(guest: &Guest) { @@ -6140,10 +6142,6 @@ mod common_parallel { // Enable the watchdog with a 15s timeout enable_guest_watchdog(&guest, 15); - // Reboot and check that systemd has activated the watchdog - guest.ssh_command("sudo reboot").unwrap(); - guest.wait_vm_boot(None).unwrap(); - expected_reboot_count += 1; assert_eq!(get_reboot_count(&guest), expected_reboot_count); assert_eq!( guest @@ -6152,7 +6150,7 @@ mod common_parallel { .trim() .parse::() .unwrap_or_default(), - 2 + 1 ); // Allow some normal time to elapse to check we don't get spurious reboots @@ -9727,13 +9725,10 @@ mod live_migration { } // Enable watchdog and ensure its functional - let mut expected_reboot_count = 1; + let expected_reboot_count = 1; // Enable the watchdog with a 15s timeout enable_guest_watchdog(&guest, 15); - // Reboot and check that systemd has activated the watchdog - guest.ssh_command("sudo reboot").unwrap(); - guest.wait_vm_boot(None).unwrap(); - expected_reboot_count += 1; + assert_eq!(get_reboot_count(&guest), expected_reboot_count); assert_eq!( guest @@ -9742,7 +9737,7 @@ mod live_migration { .trim() .parse::() .unwrap_or_default(), - 2 + 1 ); // Allow some normal time to elapse to check we don't get spurious reboots thread::sleep(std::time::Duration::new(40, 0)); @@ -9795,7 +9790,7 @@ mod live_migration { guest.check_devices_common(None, Some(&console_text), Some(&pmem_path)); // Perform checks on watchdog - let mut expected_reboot_count = 2; + let mut expected_reboot_count = 1; // Allow some normal time to elapse to check we don't get spurious reboots thread::sleep(std::time::Duration::new(40, 0));