diff options
author | Janne Heß <janne@hess.ooo> | 2022-04-15 11:23:02 +0100 |
---|---|---|
committer | Janne Heß <janne@hess.ooo> | 2022-04-16 21:17:36 +0100 |
commit | 30a00c29c4b0be54cee6f8bcfb2fdde583454407 (patch) | |
tree | c4cc9b875e32aa70ef61def3ccb7b437ca17ad22 /nixos/tests | |
parent | 031b95e587f75da4796c95e8ee232383310389c5 (diff) | |
download | nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar.gz nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar.bz2 nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar.lz nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar.xz nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.tar.zst nixpkgs-30a00c29c4b0be54cee6f8bcfb2fdde583454407.zip |
nixos/systemd: Properly shut down the system
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/all-tests.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-shutdown.nix | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index cb68ef68530..e4ea75c5db8 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -521,6 +521,7 @@ in systemd-confinement = handleTest ./systemd-confinement.nix {}; systemd-cryptenroll = handleTest ./systemd-cryptenroll.nix {}; systemd-escaping = handleTest ./systemd-escaping.nix {}; + systemd-initrd-shutdown = handleTest ./systemd-shutdown.nix { systemdStage1 = true; }; systemd-initrd-simple = handleTest ./systemd-initrd-simple.nix {}; systemd-initrd-swraid = handleTest ./systemd-initrd-swraid.nix {}; systemd-journal = handleTest ./systemd-journal.nix {}; @@ -531,6 +532,7 @@ in systemd-networkd-ipv6-prefix-delegation = handleTest ./systemd-networkd-ipv6-prefix-delegation.nix {}; systemd-networkd-vrf = handleTest ./systemd-networkd-vrf.nix {}; systemd-nspawn = handleTest ./systemd-nspawn.nix {}; + systemd-shutdown = handleTest ./systemd-shutdown.nix {}; systemd-timesyncd = handleTest ./systemd-timesyncd.nix {}; systemd-misc = handleTest ./systemd-misc.nix {}; taskserver = handleTest ./taskserver.nix {}; diff --git a/nixos/tests/systemd-shutdown.nix b/nixos/tests/systemd-shutdown.nix new file mode 100644 index 00000000000..9283489c255 --- /dev/null +++ b/nixos/tests/systemd-shutdown.nix @@ -0,0 +1,21 @@ +import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : { + name = "systemd-shutdown"; + meta = with pkgs.lib.maintainers; { + maintainers = [ das_j ]; + }; + + nodes.machine = { + imports = [ ../modules/profiles/minimal.nix ]; + boot.initrd.systemd.enable = systemdStage1; + }; + + testScript = '' + machine.wait_for_unit("multi-user.target") + # .shutdown() would wait for the machine to power off + machine.succeed("systemctl poweroff") + # Message printed by systemd-shutdown + machine.wait_for_console_text("All filesystems, swaps, loop devices, MD devices and DM devices detached.") + # Don't try to sync filesystems + machine.booted = False + ''; +}) |