3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/tests/systemd-shutdown.nix
Lily Foster 308657daec
nixos/tests/systemd-shutdown: ensure systemd-initrd variant actually enables it
It looks like the systemd-initrd variant of the systemd-shutdown test
(systemd-initrd-shutdown) did not actually enable the systemd-initrd and
so was just evaluating to the same store path before this change.
2023-02-23 19:42:45 -05:00

28 lines
882 B
Nix

import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : let
msg = "Shutting down NixOS";
in {
name = "systemd-shutdown";
meta = with pkgs.lib.maintainers; {
maintainers = [ das_j ];
};
nodes.machine = {
imports = [ ../modules/profiles/minimal.nix ];
systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/shutdown-message".source = pkgs.writeShellScript "shutdown-message" ''
echo "${msg}"
'';
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("Unmounting '/oldroot'")
machine.wait_for_console_text("${msg}")
# Don't try to sync filesystems
machine.booted = False
'';
})