about summary refs log tree commit diff
path: root/nixos/tests/containers-nested.nix
blob: 4a9fb8f01e2413839e5d8ccc8733f266635f42d0 (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
# Test for NixOS' container nesting.

import ./make-test-python.nix ({ pkgs, ... }: {
  name = "nested";

  meta = with pkgs.lib.maintainers; { maintainers = [ sorki ]; };

  nodes.machine = { lib, ... }:
    let
      makeNested = subConf: {
        containers.nested = {
          autoStart = true;
          privateNetwork = true;
          config = subConf;
        };
      };
    in makeNested (makeNested { });

  testScript = ''
    machine.start()
    machine.wait_for_unit("container@nested.service")
    machine.succeed("systemd-run --pty --machine=nested -- machinectl list | grep nested")
    print(
        machine.succeed(
            "systemd-run --pty --machine=nested -- systemd-run --pty --machine=nested -- systemctl status"
        )
    )
  '';
})