Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ea9b5c5faa9c
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 67a61fbd34fe
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Apr 24, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    67a61fb View commit details
Showing with 39 additions and 9 deletions.
  1. +39 −9 nixos/tests/podman.nix
48 changes: 39 additions & 9 deletions nixos/tests/podman.nix
Original file line number Diff line number Diff line change
@@ -10,21 +10,51 @@ import ./make-test-python.nix (
nodes = {
podman =
{ pkgs, ... }:
{
virtualisation.podman.enable = true;
{
virtualisation.podman.enable = true;
virtualisation.containers.users = [
"alice"
];

users.users.alice = {
isNormalUser = true;
home = "/home/alice";
description = "Alice Foobar";
};

};
};

testScript = ''
start_all()
import shlex
def su_cmd(cmd):
cmd = shlex.quote(cmd)
return f"su alice -l -c {cmd}"
podman.wait_for_unit("sockets.target")
podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
podman.succeed(
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
podman.succeed("podman ps | grep sleeping")
podman.succeed("podman stop sleeping")
start_all()
with subtest("Run container as root"):
podman.succeed("tar cv --files-from /dev/null | podman import - scratchimg")
podman.succeed(
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
podman.succeed("podman ps | grep sleeping")
podman.succeed("podman stop sleeping")
with subtest("Run container rootless"):
podman.succeed(su_cmd("tar cv --files-from /dev/null | podman import - scratchimg"))
podman.succeed(
su_cmd(
"podman run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10"
)
)
podman.succeed(su_cmd("podman ps | grep sleeping"))
podman.succeed(su_cmd("podman stop sleeping"))
'';
}
)