aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-05 16:04:41 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-05 16:04:41 +0200
commit4ac4f675df3da01b6d814cd328dd3219dd472ac9 (patch)
treebfedf55a309956d4f7d5247be9d619c19b2717bd /tests
parent691b7582c76e05774548e84aba92ff0eb19b2589 (diff)
Don't require --fallback to recover from disappeared binary cache NARs
Diffstat (limited to 'tests')
-rw-r--r--tests/binary-cache.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh
index cbcdca89b..eb58ae7c1 100644
--- a/tests/binary-cache.sh
+++ b/tests/binary-cache.sh
@@ -76,19 +76,28 @@ if nix-store --substituters "file://$cacheDir" -r $outPath; then
fi
-# Test whether fallback works if we have cached info but the
-# corresponding NAR has disappeared.
+# Test whether fallback works if a NAR has disappeared. This does not require --fallback.
clearStore
-nix-build --substituters "file://$cacheDir" dependencies.nix --dry-run # get info
+mv $cacheDir/nar $cacheDir/nar2
+
+nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result
+
+mv $cacheDir/nar2 $cacheDir/nar
+
+
+# Test whether fallback works if a NAR is corrupted. This does require --fallback.
+clearStore
-mkdir $cacheDir/tmp
mv $cacheDir/nar $cacheDir/nar2
+mkdir $cacheDir/nar
+for i in $(cd $cacheDir/nar2 && echo *); do touch $cacheDir/nar/$i; done
(! nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result)
nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result --fallback
+rm -rf $cacheDir/nar
mv $cacheDir/nar2 $cacheDir/nar