nixos/switchTest: Also test systemd restarts

Changed files
+9
nixos
+9
nixos/tests/switch-test.nix
···
echo "systemd 0" > $out/init-interface-version
'';
simpleService.configuration = {
systemd.services.test = {
wantedBy = [ "multi-user.target" ];
···
with subtest("init interface version"):
# Do not try to switch to an invalid init interface version
assert "incompatible" in switch_to_specialisation("${machine}", "brokenInitInterface", fail=True)
with subtest("services"):
switch_to_specialisation("${machine}", "")
···
echo "systemd 0" > $out/init-interface-version
'';
+
modifiedSystemConf.configuration.systemd.extraConfig = ''
+
# Hello world!
+
'';
+
simpleService.configuration = {
systemd.services.test = {
wantedBy = [ "multi-user.target" ];
···
with subtest("init interface version"):
# Do not try to switch to an invalid init interface version
assert "incompatible" in switch_to_specialisation("${machine}", "brokenInitInterface", fail=True)
+
+
with subtest("systemd restarts"):
+
# systemd is restarted when its system.conf changes
+
out = switch_to_specialisation("${machine}", "modifiedSystemConf")
+
assert_contains(out, "restarting systemd...")
with subtest("services"):
switch_to_specialisation("${machine}", "")