diff options
author | WxNzEMof <143541718+WxNzEMof@users.noreply.github.com> | 2024-02-26 19:26:07 +0000 |
---|---|---|
committer | WxNzEMof <143541718+WxNzEMof@users.noreply.github.com> | 2024-02-26 19:29:04 +0000 |
commit | 4733b52c6ba492d5aae6292c236f2f472cdcad0b (patch) | |
tree | d45d7a7ef26f03203472553a6b9202cfca06e950 | |
parent | b2f19980dbe86e2c8e19877035e8a1753636a72c (diff) |
dockerTools.tests.docker-tools: Add non-root streamLayeredImage test
-rw-r--r-- | nixos/tests/docker-tools.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix index b819932ca4cc..7d91076600f9 100644 --- a/nixos/tests/docker-tools.nix +++ b/nixos/tests/docker-tools.nix @@ -58,6 +58,20 @@ let ''; config.Cmd = [ "${pkgs.coreutils}/bin/stat" "-c" "%u:%g" "/testfile" ]; }; + + nonRootTestImage = + pkgs.dockerTools.streamLayeredImage rec { + name = "non-root-test"; + tag = "latest"; + uid = 1000; + gid = 1000; + uname = "user"; + gname = "user"; + config = { + User = "user"; + Cmd = [ "${pkgs.coreutils}/bin/stat" "-c" "%u:%g" "${pkgs.coreutils}/bin/stat" ]; + }; + }; in { name = "docker-tools"; meta = with pkgs.lib.maintainers; { @@ -604,5 +618,11 @@ in { "${chownTestImage} | docker load", "docker run --rm ${chownTestImage.imageName} | diff /dev/stdin <(echo 12345:12345)" ) + + with subtest("streamLayeredImage: with non-root user"): + docker.succeed( + "${nonRootTestImage} | docker load", + "docker run --rm ${chownTestImage.imageName} | diff /dev/stdin <(echo 12345:12345)" + ) ''; }) |