From baa78de59403a69936bd9fc4709707d600926308 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Thu, 30 Jan 2020 22:35:16 +0100 Subject: [PATCH] nixosTests.docker-tools: add bulk-layer test A regression test for https://github.com/NixOS/nixpkgs/issues/78744. --- nixos/tests/docker-tools.nix | 6 ++++++ pkgs/build-support/docker/examples.nix | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix index 07fac5336803..ca750e8ba3cd 100644 --- a/nixos/tests/docker-tools.nix +++ b/nixos/tests/docker-tools.nix @@ -83,5 +83,11 @@ import ./make-test.nix ({ pkgs, ... }: { # Ensure image with only 2 layers can be loaded $docker->succeed("docker load --input='${pkgs.dockerTools.examples.two-layered-image}'"); + + # Ensure the bulk layer didn't miss store paths + # Regression test for https://github.com/NixOS/nixpkgs/issues/78744 + $docker->succeed("docker load --input='${pkgs.dockerTools.examples.bulk-layer}'"); + # This ensure the two output paths (ls and hello) are in the layer + $docker->succeed("docker run bulk-layer ls /bin/hello"); ''; }) diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix index f6520201a64a..f0dcf236c0e4 100644 --- a/pkgs/build-support/docker/examples.nix +++ b/pkgs/build-support/docker/examples.nix @@ -247,4 +247,15 @@ rec { maxLayers = 2; }; + # 16. Create a layered image with more packages than max layers. + # coreutils and hello are part of the same layer + bulk-layer = pkgs.dockerTools.buildLayeredImage { + name = "bulk-layer"; + tag = "latest"; + contents = with pkgs; [ + coreutils hello + ]; + maxLayers = 2; + }; + }