1 import ./make-test-python.nix ({ pkgs, lib, ... }:
7 environment.etc.check.text = "client_base";
11 # prevent make-test-python.nix to change IP
12 networking.interfaces = {
13 eth1.ipv4.addresses = lib.mkOverride 0 [ ];
17 name = "containers-reloadable";
19 maintainers = with lib.maintainers; [ danbst ];
24 imports = [ client_base ];
27 client_c1 = { lib, ... }: {
28 imports = [ client_base ];
30 containers.test1.config = {
31 environment.etc.check.text = lib.mkForce "client_c1";
32 services.httpd.enable = true;
33 services.httpd.adminAddr = "nixos@example.com";
36 client_c2 = { lib, ... }: {
37 imports = [ client_base ];
39 containers.test1.config = {
40 environment.etc.check.text = lib.mkForce "client_c2";
41 services.nginx.enable = true;
46 testScript = {nodes, ...}: let
47 c1System = nodes.client_c1.config.system.build.toplevel;
48 c2System = nodes.client_c2.config.system.build.toplevel;
51 client.wait_for_unit("default.target")
53 assert "client_base" in client.succeed("nixos-container run test1 cat /etc/check")
55 with subtest("httpd is available after activating config1"):
57 "${c1System}/bin/switch-to-configuration test >&2",
58 "[[ $(nixos-container run test1 cat /etc/check) == client_c1 ]] >&2",
59 "systemctl status httpd -M test1 >&2",
62 with subtest("httpd is not available any longer after switching to config2"):
64 "${c2System}/bin/switch-to-configuration test >&2",
65 "[[ $(nixos-container run test1 cat /etc/check) == client_c2 ]] >&2",
66 "systemctl status nginx -M test1 >&2",
68 client.fail("systemctl status httpd -M test1 >&2")