Skip to content

Commit

Permalink
tests: restart systemd daemon to reload systemd configuration
Browse files Browse the repository at this point in the history
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 <sionli@tencent.com>
  • Loading branch information
Songqian Li authored and rbradford committed May 15, 2024
1 parent 6c4947e commit de38e4b
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -6152,7 +6150,7 @@ mod common_parallel {
.trim()
.parse::<u32>()
.unwrap_or_default(),
2
1
);

// Allow some normal time to elapse to check we don't get spurious reboots
Expand Down Expand Up @@ -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
Expand All @@ -9742,7 +9737,7 @@ mod live_migration {
.trim()
.parse::<u32>()
.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));
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit de38e4b

Please sign in to comment.