1 import ./make-test-python.nix (
4 name = "containers-reloadable";
6 maintainers = with lib.maintainers; [ danbst ];
15 config.environment.etc.check.text = "client_base";
18 # prevent make-test-python.nix to change IP
19 networking.interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [ ];
21 specialisation.c1.configuration = {
22 containers.test1.config = {
23 environment.etc.check.text = lib.mkForce "client_c1";
24 services.httpd.enable = true;
25 services.httpd.adminAddr = "nixos@example.com";
29 specialisation.c2.configuration = {
30 containers.test1.config = {
31 environment.etc.check.text = lib.mkForce "client_c2";
32 services.nginx.enable = true;
40 machine.wait_for_unit("default.target")
42 assert "client_base" in machine.succeed("nixos-container run test1 cat /etc/check")
44 with subtest("httpd is available after activating config1"):
46 "/run/booted-system/specialisation/c1/bin/switch-to-configuration test >&2",
47 "[[ $(nixos-container run test1 cat /etc/check) == client_c1 ]] >&2",
48 "systemctl status httpd -M test1 >&2",
51 with subtest("httpd is not available any longer after switching to config2"):
53 "/run/booted-system/specialisation/c2/bin/switch-to-configuration test >&2",
54 "[[ $(nixos-container run test1 cat /etc/check) == client_c2 ]] >&2",
55 "systemctl status nginx -M test1 >&2",
57 machine.fail("systemctl status httpd -M test1 >&2")