nixos/podman: Add test with podman without runc

Changed files
+32
nixos
tests
podman
+32
nixos/tests/podman/default.nix
···
boot.supportedFilesystems = [ "zfs" ];
networking.hostId = "00000000";
};
+
rootful_norunc =
+
{ pkgs, ... }:
+
{
+
virtualisation.podman.enable = true;
+
virtualisation.podman.extraRuntimes = [ ];
+
};
rootless =
{ pkgs, ... }:
{
···
rootful.wait_for_unit("sockets.target")
+
rootful_norunc.wait_for_unit("sockets.target")
rootless.wait_for_unit("sockets.target")
dns.wait_for_unit("sockets.target")
docker.wait_for_unit("sockets.target")
···
rootful.succeed("podman ps | grep sleeping")
rootful.succeed("podman stop sleeping")
rootful.succeed("podman rm sleeping")
+
+
# now without installed runc
+
with subtest("Run runc-less container as root with runc"):
+
rootful_norunc.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
+
rootful_norunc.fail(
+
"podman run --runtime=runc -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
+
)
+
+
with subtest("Run runc-less container as root with crun"):
+
rootful_norunc.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
+
rootful_norunc.succeed(
+
"podman run --runtime=crun -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
+
)
+
rootful_norunc.succeed("podman ps | grep sleeping")
+
rootful_norunc.succeed("podman stop sleeping")
+
rootful_norunc.succeed("podman rm sleeping")
+
+
with subtest("Run runc-less container as root with the default backend"):
+
rootful_norunc.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
+
rootful_norunc.succeed(
+
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
+
)
+
rootful_norunc.succeed("podman ps | grep sleeping")
+
rootful_norunc.succeed("podman stop sleeping")
+
rootful_norunc.succeed("podman rm sleeping")
# start systemd session for rootless
rootless.succeed("loginctl enable-linger alice")