Skip to content

Commit baa78de

Browse files
committed
nixosTests.docker-tools: add bulk-layer test
A regression test for #78744.
1 parent 3b65b3f commit baa78de

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

nixos/tests/docker-tools.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,11 @@ import ./make-test.nix ({ pkgs, ... }: {
8383
8484
# Ensure image with only 2 layers can be loaded
8585
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.two-layered-image}'");
86+
87+
# Ensure the bulk layer didn't miss store paths
88+
# Regression test for https://github.com/NixOS/nixpkgs/issues/78744
89+
$docker->succeed("docker load --input='${pkgs.dockerTools.examples.bulk-layer}'");
90+
# This ensure the two output paths (ls and hello) are in the layer
91+
$docker->succeed("docker run bulk-layer ls /bin/hello");
8692
'';
8793
})

pkgs/build-support/docker/examples.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,15 @@ rec {
247247
maxLayers = 2;
248248
};
249249

250+
# 16. Create a layered image with more packages than max layers.
251+
# coreutils and hello are part of the same layer
252+
bulk-layer = pkgs.dockerTools.buildLayeredImage {
253+
name = "bulk-layer";
254+
tag = "latest";
255+
contents = with pkgs; [
256+
coreutils hello
257+
];
258+
maxLayers = 2;
259+
};
260+
250261
}

0 commit comments

Comments
 (0)