summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorRichard Marko <srk@48.io>2021-02-24 14:02:57 +0100
committerRichard Marko <srk@48.io>2021-03-04 12:04:31 +0100
commitd23ba22076f64c9daffedde66376b11796046b40 (patch)
tree3164c04da94f4e9440f3937442692d64f793cc7d /nixos/tests
parentfc2fa3cda56d61d5d81b9a0d2b478aa76d5d7101 (diff)
downloadnixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar.gz
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar.bz2
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar.lz
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar.xz
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.tar.zst
nixpkgs-d23ba22076f64c9daffedde66376b11796046b40.zip
nixosTests.containers-nested: init
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/containers-nested.nix30
2 files changed, 31 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 7d676e15fa9..3784dc6c886 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -74,6 +74,7 @@ in
   containers-ip = handleTest ./containers-ip.nix {};
   containers-macvlans = handleTest ./containers-macvlans.nix {};
   containers-names = handleTest ./containers-names.nix {};
+  containers-nested = handleTest ./containers-nested.nix {};
   containers-physical_interfaces = handleTest ./containers-physical_interfaces.nix {};
   containers-portforward = handleTest ./containers-portforward.nix {};
   containers-reloadable = handleTest ./containers-reloadable.nix {};
diff --git a/nixos/tests/containers-nested.nix b/nixos/tests/containers-nested.nix
new file mode 100644
index 00000000000..a653361494f
--- /dev/null
+++ b/nixos/tests/containers-nested.nix
@@ -0,0 +1,30 @@
+# Test for NixOS' container nesting.
+
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "nested";
+
+  meta = with pkgs.lib.maintainers; { maintainers = [ sorki ]; };
+
+  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"
+        )
+    )
+  '';
+})
+