diff options
author | Astro | 2023-03-16 01:50:15 +0100 |
---|---|---|
committer | Astro | 2023-03-16 01:50:15 +0100 |
commit | 64a4ae6f37de056eb0aa3b4eb00dc47570910823 (patch) | |
tree | 271b98384f8d61f7f5eba38470535218013c2bf6 /nixos | |
parent | f4331c498367fb94d198250fb4ef285fd340bb94 (diff) |
nixos/test-driver: remove allow_reboot state from Machine, make it a start() kwarg
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/test-driver/test_driver/driver.py | 1 | ||||
-rw-r--r-- | nixos/lib/test-driver/test_driver/machine.py | 9 | ||||
-rw-r--r-- | nixos/tests/login.nix | 2 |
3 files changed, 4 insertions, 8 deletions
diff --git a/nixos/lib/test-driver/test_driver/driver.py b/nixos/lib/test-driver/test_driver/driver.py index de6abbb4679e..ad52f365737c 100644 --- a/nixos/lib/test-driver/test_driver/driver.py +++ b/nixos/lib/test-driver/test_driver/driver.py @@ -179,7 +179,6 @@ class Driver: start_command=cmd, name=name, keep_vm_state=args.get("keep_vm_state", False), - allow_reboot=args.get("allow_reboot", False), ) def serial_stdout_on(self) -> None: diff --git a/nixos/lib/test-driver/test_driver/machine.py b/nixos/lib/test-driver/test_driver/machine.py index aa8e1a83b8a0..4929f2048ecc 100644 --- a/nixos/lib/test-driver/test_driver/machine.py +++ b/nixos/lib/test-driver/test_driver/machine.py @@ -311,7 +311,6 @@ class Machine: start_command: StartCommand keep_vm_state: bool - allow_reboot: bool process: Optional[subprocess.Popen] pid: Optional[int] @@ -336,13 +335,11 @@ class Machine: start_command: StartCommand, name: str = "machine", keep_vm_state: bool = False, - allow_reboot: bool = False, callbacks: Optional[List[Callable]] = None, ) -> None: self.out_dir = out_dir self.tmp_dir = tmp_dir self.keep_vm_state = keep_vm_state - self.allow_reboot = allow_reboot self.name = name self.start_command = start_command self.callbacks = callbacks if callbacks is not None else [] @@ -873,7 +870,7 @@ class Machine: self.process.stdin.write(chars.encode()) self.process.stdin.flush() - def start(self) -> None: + def start(self, allow_reboot: bool = False) -> None: if self.booted: return @@ -897,7 +894,7 @@ class Machine: self.shared_dir, self.monitor_path, self.shell_path, - self.allow_reboot, + allow_reboot, ) self.monitor, _ = monitor_socket.accept() self.shell, _ = shell_socket.accept() @@ -950,7 +947,7 @@ class Machine: """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` + machine was started with `allow_reboot = True` """ self.send_key(f"ctrl-alt-delete") self.connected = False diff --git a/nixos/tests/login.nix b/nixos/tests/login.nix index 97d7c7b9b535..67f5764a0a16 100644 --- a/nixos/tests/login.nix +++ b/nixos/tests/login.nix @@ -13,7 +13,7 @@ import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }: }; testScript = '' - machine.allow_reboot = True + machine.start(allow_reboot = True) machine.wait_for_unit("multi-user.target") machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'") |