Test switching to a new config and deactivating.
This commit is contained in:
parent
9bef20370c
commit
e17423e226
1 changed files with 48 additions and 1 deletions
|
|
@ -4,7 +4,42 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
lib.flip lib.mapAttrs' system-manager.lib.images.ubuntu.${system} (imgName: image:
|
lib.flip lib.mapAttrs' system-manager.lib.images.ubuntu.${system} (imgName: image:
|
||||||
lib.nameValuePair "example-${imgName}"
|
let
|
||||||
|
newConfig = system-manager.lib.makeSystemConfig {
|
||||||
|
modules = [
|
||||||
|
({ lib, pkgs, ... }: {
|
||||||
|
config = {
|
||||||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
|
|
||||||
|
services.nginx.enable = true;
|
||||||
|
|
||||||
|
environment.etc = {
|
||||||
|
foo_new = {
|
||||||
|
text = ''
|
||||||
|
This is just a test!
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
systemd.services.new-service = {
|
||||||
|
enable = true;
|
||||||
|
description = "new-service";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecReload = "${lib.getBin pkgs.coreutils}/bin/true";
|
||||||
|
};
|
||||||
|
wantedBy = [ "system-manager.target" ];
|
||||||
|
script = ''
|
||||||
|
sleep 2
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
lib.nameValuePair
|
||||||
|
"example-${imgName}"
|
||||||
(system-manager.lib.make-vm-test {
|
(system-manager.lib.make-vm-test {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
|
|
@ -37,9 +72,21 @@ lib.nameValuePair "example-${imgName}"
|
||||||
|
|
||||||
node1.wait_for_unit("service-9.service")
|
node1.wait_for_unit("service-9.service")
|
||||||
node1.wait_for_file("/etc/baz/bar/foo2")
|
node1.wait_for_file("/etc/baz/bar/foo2")
|
||||||
|
node1.wait_for_file("/etc/a/nested/example/foo3")
|
||||||
node1.wait_for_file("/etc/foo.conf")
|
node1.wait_for_file("/etc/foo.conf")
|
||||||
node1.succeed("grep -F 'launch_the_rockets = true' /etc/foo.conf")
|
node1.succeed("grep -F 'launch_the_rockets = true' /etc/foo.conf")
|
||||||
node1.fail("grep -F 'launch_the_rockets = false' /etc/foo.conf")
|
node1.fail("grep -F 'launch_the_rockets = false' /etc/foo.conf")
|
||||||
|
|
||||||
|
node1.execute("${newConfig}/bin/activate")
|
||||||
|
node1.wait_for_unit("new-service.service")
|
||||||
|
node1.wait_until_fails("systemctl status service-9.service")
|
||||||
|
node1.wait_until_fails("cat /etc/a/nested/example/foo3")
|
||||||
|
node1.wait_until_fails("cat /etc/baz/bar/foo2")
|
||||||
|
node1.wait_for_file("/etc/foo_new")
|
||||||
|
|
||||||
|
node1.execute("${newConfig}/bin/deactivate")
|
||||||
|
node1.wait_until_fails("systemctl status new-service.service")
|
||||||
|
node1.wait_until_fails("cat /etc/foo_new")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue