nixos/switchTest: Also check for base unit modifications
This commit is contained in:
parent
d073105d6b
commit
7937c5816d
|
@ -279,6 +279,28 @@ in {
|
||||||
systemd.services.test-service.unitConfig.RefuseManualStart = true;
|
systemd.services.test-service.unitConfig.RefuseManualStart = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unitWithTemplate.configuration = {
|
||||||
|
systemd.services."instantiated@".serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${pkgs.coreutils}/bin/true";
|
||||||
|
ExecReload = "${pkgs.coreutils}/bin/true";
|
||||||
|
};
|
||||||
|
systemd.services."instantiated@one" = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
overrideStrategy = "asDropin";
|
||||||
|
};
|
||||||
|
systemd.services."instantiated@two" = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
overrideStrategy = "asDropin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
unitWithTemplateModified.configuration = {
|
||||||
|
imports = [ unitWithTemplate.configuration ];
|
||||||
|
systemd.services."instantiated@".serviceConfig.X-Test = "test";
|
||||||
|
};
|
||||||
|
|
||||||
restart-and-reload-by-activation-script.configuration = {
|
restart-and-reload-by-activation-script.configuration = {
|
||||||
systemd.services = rec {
|
systemd.services = rec {
|
||||||
simple-service = {
|
simple-service = {
|
||||||
|
@ -770,6 +792,16 @@ in {
|
||||||
assert_contains(out, "\nstarting the following units: required-service.service\n")
|
assert_contains(out, "\nstarting the following units: required-service.service\n")
|
||||||
assert_lacks(out, "the following new units were started:")
|
assert_lacks(out, "the following new units were started:")
|
||||||
|
|
||||||
|
# Ensure templated units are restarted when the base unit changes
|
||||||
|
switch_to_specialisation("${machine}", "unitWithTemplate")
|
||||||
|
out = switch_to_specialisation("${machine}", "unitWithTemplateModified")
|
||||||
|
assert_contains(out, "stopping the following units: instantiated@one.service, instantiated@two.service\n")
|
||||||
|
assert_lacks(out, "NOT restarting the following changed units:")
|
||||||
|
assert_lacks(out, "reloading the following units:")
|
||||||
|
assert_lacks(out, "\nrestarting the following units:")
|
||||||
|
assert_contains(out, "\nstarting the following units: instantiated@one.service, instantiated@two.service\n")
|
||||||
|
assert_lacks(out, "the following new units were started:")
|
||||||
|
|
||||||
with subtest("failing units"):
|
with subtest("failing units"):
|
||||||
# Let the simple service fail
|
# Let the simple service fail
|
||||||
switch_to_specialisation("${machine}", "simpleServiceModified")
|
switch_to_specialisation("${machine}", "simpleServiceModified")
|
||||||
|
|
Loading…
Reference in a new issue