summary refs log tree commit diff
path: root/nixos/tests/docker-tools.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-05-25 15:04:45 +0200
committerRobert Hensing <robert@roberthensing.nl>2021-05-26 15:11:42 +0200
commit5259d66b7487b94233821e28aafb0683ae3f1df6 (patch)
treef35e0515750525e1e0a698e0cdcd73b72fbf7f9b /nixos/tests/docker-tools.nix
parent69de7cc12abfa1d0434750e5d346c299992a57ec (diff)
downloadnixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar.gz
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar.bz2
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar.lz
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar.xz
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.tar.zst
nixpkgs-5259d66b7487b94233821e28aafb0683ae3f1df6.zip
dockerTools: Allow omitting all store paths
Adds includeStorePaths, allowing the omission of the store paths.
You generally want to leave it on, but tooling may disable this
to insert the store paths more efficiently via other means, such
as bind mounting the host store.
Diffstat (limited to 'nixos/tests/docker-tools.nix')
-rw-r--r--nixos/tests/docker-tools.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 39b97b4cb99..831ef2fb77a 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -20,6 +20,20 @@ import ./make-test-python.nix ({ pkgs, ... }: {
 
     docker.wait_for_unit("sockets.target")
 
+    with subtest("includeStorePath"):
+        with subtest("assumption"):
+            docker.succeed("${examples.helloOnRoot} | docker load")
+            docker.succeed("set -euo pipefail; docker run --rm hello | grep -i hello")
+            docker.succeed("docker image rm hello:latest")
+        with subtest("includeStorePath = false; breaks example"):
+            docker.succeed("${examples.helloOnRootNoStore} | docker load")
+            docker.fail("set -euo pipefail; docker run --rm hello | grep -i hello")
+            docker.succeed("docker image rm hello:latest")
+        with subtest("includeStorePath = false; works with mounted store"):
+            docker.succeed("${examples.helloOnRootNoStore} | docker load")
+            docker.succeed("set -euo pipefail; docker run --rm --volume ${builtins.storeDir}:${builtins.storeDir}:ro hello | grep -i hello")
+            docker.succeed("docker image rm hello:latest")
+
     with subtest("Ensure Docker images use a stable date by default"):
         docker.succeed(
             "docker load --input='${examples.bash}'"