about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2023-02-18 20:52:04 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2023-02-22 10:16:58 +1000
commit07b8c65c77c7fbafc28dcefb4041bc7ff9e5bdc6 (patch)
treedb8028be9f4e04ae2edd02a528c4da62ad294f55 /nixos/tests
parent9ab047538fa0dc1ca1a0e64380553308731bf775 (diff)
nixos/tests/podman: add test for rootless port forwarding
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/podman/default.nix12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/tests/podman/default.nix b/nixos/tests/podman/default.nix
index 87e212eb8cd1e..69397197775f8 100644
--- a/nixos/tests/podman/default.nix
+++ b/nixos/tests/podman/default.nix
@@ -123,6 +123,18 @@ import ../make-test-python.nix (
           rootless.succeed(su_cmd("podman stop sleeping"))
           rootless.succeed(su_cmd("podman rm sleeping"))
 
+      with subtest("rootlessport"):
+          rootless.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
+          rootless.succeed(
+              su_cmd(
+                  "podman run -d -p 9000:8888 --name=rootlessport -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin -w ${pkgs.writeTextDir "index.html" "<h1>Testing</h1>"} scratchimg ${pkgs.python3}/bin/python -m http.server 8888"
+              )
+          )
+          rootless.succeed(su_cmd("podman ps | grep rootlessport"))
+          rootless.wait_until_succeeds(su_cmd("${pkgs.curl}/bin/curl localhost:9000 | grep Testing"))
+          rootless.succeed(su_cmd("podman stop rootlessport"))
+          rootless.succeed(su_cmd("podman rm rootlessport"))
+
       with subtest("Run container with init"):
           rootful.succeed(
               "tar cv -C ${pkgs.pkgsStatic.busybox} . | podman import - busybox"