about summary refs log tree commit diff
path: root/nixpkgs/nixos/tests/nesting.nix
blob: 1306d6f8e0c555483660880d058c8d69bba57920 (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
import ./make-test.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->waitForUnit("default.target");
    $clone->succeed("cowsay hey");
    $clone->fail("hello");

    # 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->waitForUnit("default.target");
    $children->succeed("cowsay hey");
    $children->fail("hello");

    # 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");

  '';
}