From 9fc85a85d579014b0caddb2b33f3cb19a02c6883 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 16 Mar 2023 00:30:01 +0100 Subject: [PATCH] nixos/test-driver: implement Machine.reboot() --- nixos/lib/test-driver/test_driver/machine.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py index a4f7a555f81..aa8e1a83b8a 100644 --- a/nixos/lib/test-driver/test_driver/machine.py +++ b/nixos/lib/test-driver/test_driver/machine.py @@ -946,6 +946,15 @@ class Machine: self.send_monitor_command("quit") self.wait_for_shutdown() + def reboot(self) -> None: + """Press Ctrl+Alt+Delete in the guest. + + Prepares the machine to be reconnected which is useful if the + machine was started after setting `machine.allow_reboot = True` + """ + self.send_key(f"ctrl-alt-delete") + self.connected = False + def wait_for_x(self) -> None: """Wait until it is possible to connect to the X server. Note that testing the existence of /tmp/.X11-unix/X0 is insufficient.