aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-03 22:14:21 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-03 22:14:45 +0000
commit145915eb3901ad78e61f27df22e755fdf9a2c28a (patch)
tree45d7cff87423d17a8860ae493641620af15f69fd /tests
parente7d93e7ece8fd6906e45d0ea21fa08e00b815ca8 (diff)
Beef up floating CA derivations test a bit
Diffstat (limited to 'tests')
-rw-r--r--tests/content-addressed.nix37
-rw-r--r--tests/content-addressed.sh7
2 files changed, 29 insertions, 15 deletions
diff --git a/tests/content-addressed.nix b/tests/content-addressed.nix
index 586e4cba6..1fa6aabff 100644
--- a/tests/content-addressed.nix
+++ b/tests/content-addressed.nix
@@ -4,16 +4,29 @@ with import ./config.nix;
# A simple content-addressed derivation.
# The derivation can be arbitrarily modified by passing a different `seed`,
# but the output will always be the same
-mkDerivation {
- name = "simple-content-addressed";
- buildCommand = ''
- set -x
- echo "Building a CA derivation"
- echo "The seed is ${toString seed}"
- mkdir -p $out
- echo "Hello World" > $out/hello
- '';
- __contentAddressed = true;
- outputHashMode = "recursive";
- outputHashAlgo = "sha256";
+rec {
+ rootLegacy = mkDerivation {
+ name = "simple-content-addressed";
+ buildCommand = ''
+ set -x
+ echo "Building a legacy derivation"
+ mkdir -p $out
+ echo "Hello World" > $out/hello
+ '';
+ __contentAddressed = true;
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ };
+ rootCA = mkDerivation {
+ name = "dependent";
+ buildCommand = ''
+ echo "building a CA derivation"
+ echo "The seed is ${toString seed}"
+ mkdir -p $out
+ echo ${rootLegacy}/hello > $out/dep
+ '';
+ __contentAddressed = true;
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ };
}
diff --git a/tests/content-addressed.sh b/tests/content-addressed.sh
index 2968f3a8c..ae9e3c59e 100644
--- a/tests/content-addressed.sh
+++ b/tests/content-addressed.sh
@@ -7,10 +7,11 @@ clearCache
export REMOTE_STORE=file://$cacheDir
-drv=$(nix-instantiate --experimental-features ca-derivations ./content-addressed.nix --arg seed 1)
+drv=$(nix-instantiate --experimental-features ca-derivations ./content-addressed.nix -A rootCA --arg seed 1)
nix --experimental-features 'nix-command ca-derivations' show-derivation --derivation "$drv" --arg seed 1
-out1=$(nix-build --experimental-features ca-derivations ./content-addressed.nix --arg seed 1 --no-out-link)
-out2=$(nix-build --experimental-features ca-derivations ./content-addressed.nix --arg seed 2 --no-out-link)
+commonArgs=("--experimental-features" "ca-derivations" "./content-addressed.nix" "-A" "rootCA" "--no-out-link")
+out1=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 1)
+out2=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 2)
test $out1 == $out2