1 import ./make-test-python.nix ({ pkgs, lib, ... }:
3 name = "containers-reloadable";
5 maintainers = with lib.maintainers; [ danbst ];
9 machine = { lib, ... }: {
12 config.environment.etc.check.text = "client_base";
15 # prevent make-test-python.nix to change IP
16 networking.interfaces.eth1.ipv4.addresses = lib.mkOverride 0 [ ];
18 specialisation.c1.configuration = {
19 containers.test1.config = {
20 environment.etc.check.text = lib.mkForce "client_c1";
21 services.httpd.enable = true;
22 services.httpd.adminAddr = "nixos@example.com";
26 specialisation.c2.configuration = {
27 containers.test1.config = {
28 environment.etc.check.text = lib.mkForce "client_c2";
29 services.nginx.enable = true;
37 machine.wait_for_unit("default.target")
39 assert "client_base" in machine.succeed("nixos-container run test1 cat /etc/check")
41 with subtest("httpd is available after activating config1"):
43 "/run/booted-system/specialisation/c1/bin/switch-to-configuration test >&2",
44 "[[ $(nixos-container run test1 cat /etc/check) == client_c1 ]] >&2",
45 "systemctl status httpd -M test1 >&2",
48 with subtest("httpd is not available any longer after switching to config2"):
50 "/run/booted-system/specialisation/c2/bin/switch-to-configuration test >&2",
51 "[[ $(nixos-container run test1 cat /etc/check) == client_c2 ]] >&2",
52 "systemctl status nginx -M test1 >&2",
54 machine.fail("systemctl status httpd -M test1 >&2")