Skip to content

Commit

Permalink
nixosTests.docker-tools: add bulk-layer test
Browse files Browse the repository at this point in the history
A regression test for #78744.
  • Loading branch information
nlewo committed Feb 14, 2020
1 parent 3b65b3f commit baa78de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nixos/tests/docker-tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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");
'';
})
11 changes: 11 additions & 0 deletions pkgs/build-support/docker/examples.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

}

0 comments on commit baa78de

Please sign in to comment.