summary refs log tree commit diff
path: root/nixos/tests/docker-tools.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2020-02-24 00:41:55 +0100
committerRobert Hensing <robert@roberthensing.nl>2020-02-28 14:59:04 +0100
commit6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef (patch)
treeb5dd8e7f02bda9558b86b37f12edfad0f0f536ce /nixos/tests/docker-tools.nix
parentddc2f887f5f4b31128e8d4a56cb524c1d36d6fd4 (diff)
downloadnixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar.gz
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar.bz2
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar.lz
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar.xz
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.tar.zst
nixpkgs-6dab1b50a63fa6e9dfb9bd9eddd3f5d5c7b055ef.zip
buildLayeredImage: Allow empty store, no paths to add
This is useful when buildLayeredImage is called in a generic way
that should allow simple (base) images to be built, which may not
reference any store paths.
Diffstat (limited to 'nixos/tests/docker-tools.nix')
-rw-r--r--nixos/tests/docker-tools.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 54dd97e5b13..51b472fcf9c 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -137,5 +137,22 @@ import ./make-test-python.nix ({ pkgs, ... }: {
             # Ensure the two output paths (ls and hello) are in the layer
             "docker run bulk-layer ls /bin/hello",
         )
+
+    with subtest("Ensure correct behavior when no store is needed"):
+        # This check tests two requirements simultaneously
+        #  1. buildLayeredImage can build images that don't need a store.
+        #  2. Layers of symlinks are eliminated by the customization layer.
+        #
+        docker.succeed(
+            "docker load --input='${pkgs.dockerTools.examples.no-store-paths}'"
+        )
+
+        # Busybox will not recognize argv[0] and print an error message with argv[0],
+        # but it confirms that the custom-true symlink is present.
+        docker.succeed("docker run --rm no-store-paths custom-true |& grep custom-true")
+
+        # This check may be loosened to allow an *empty* store rather than *no* store.
+        docker.succeed("docker run --rm no-store-paths ls /")
+        docker.fail("docker run --rm no-store-paths ls /nix/store")
   '';
 })