nixos/tests/login: use machine.reboot() for a proper reboot

This commit is contained in:
Astro 2023-03-16 01:42:00 +01:00
parent 9fc85a85d5
commit f4331c4983

View file

@ -13,6 +13,8 @@ import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
};
testScript = ''
machine.allow_reboot = True
machine.wait_for_unit("multi-user.target")
machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
machine.screenshot("postboot")
@ -53,7 +55,14 @@ import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
machine.screenshot("getty")
with subtest("Check whether ctrl-alt-delete works"):
machine.send_key("ctrl-alt-delete")
machine.wait_for_shutdown()
boot_id1 = machine.succeed("cat /proc/sys/kernel/random/boot_id").strip()
assert boot_id1 != ""
machine.reboot()
boot_id2 = machine.succeed("cat /proc/sys/kernel/random/boot_id").strip()
assert boot_id2 != ""
assert boot_id1 != boot_id2
'';
})