about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorAstro <astro@spaceboyz.net>2023-03-16 00:30:01 +0100
committerAstro <astro@spaceboyz.net>2023-03-16 01:41:32 +0100
commit9fc85a85d579014b0caddb2b33f3cb19a02c6883 (patch)
tree6f81a076cd52764fc6a5c576df7fe91278e8b86a /nixos/lib
parent95d121e7983cabe9977779af948ccd46cb4845a6 (diff)
downloadnixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar.gz
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar.bz2
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar.lz
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar.xz
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.tar.zst
nixlib-9fc85a85d579014b0caddb2b33f3cb19a02c6883.zip
nixos/test-driver: implement Machine.reboot()
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test_driver/machine.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py
index a4f7a555f818..aa8e1a83b8a0 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.