about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/nesting.nix
blob: a75806b24ff6ebe89361ec633c8c8ab6c5ec467d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import ./make-test-python.nix {
  name = "nesting";
  nodes =  {
    clone = { pkgs, ... }: {
      environment.systemPackages = [ pkgs.cowsay ];
      nesting.clone = [
        ({ pkgs, ... }: {
          environment.systemPackages = [ pkgs.hello ];
        })
      ];
    };
    children = { pkgs, ... }: {
      environment.systemPackages = [ pkgs.cowsay ];
      nesting.children = [
        ({ pkgs, ... }: {
          environment.systemPackages = [ pkgs.hello ];
        })
      ];
    };
  };
  testScript = ''
    clone.wait_for_unit("default.target")
    clone.succeed("cowsay hey")
    clone.fail("hello")

    with subtest("Nested clones do inherit from parent"):
        clone.succeed(
            "/run/current-system/fine-tune/child-1/bin/switch-to-configuration test"
        )
        clone.succeed("cowsay hey")
        clone.succeed("hello")

    children.wait_for_unit("default.target")
    children.succeed("cowsay hey")
    children.fail("hello")

    with subtest("Nested children do not inherit from parent"):
        children.succeed(
            "/run/current-system/fine-tune/child-1/bin/switch-to-configuration test"
        )
        children.fail("cowsay hey")
        children.succeed("hello")
  '';
}