about summary refs log tree commit diff
path: root/tests/binary-cache.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-05T12·44+0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-05T13·26+0200
commitca06a9cea706bf06374efeed276cf3a90d2eaa80 (patch)
tree16d1ae7e65eab6b77d186af2b9c9ac634a254584 /tests/binary-cache.sh
parenta2ec7a3bfd33a4792185a74e2ae20b48f7ac2de9 (diff)
Improve binary cache fallback test
Diffstat (limited to 'tests/binary-cache.sh')
-rw-r--r--tests/binary-cache.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh
index 28b265686930..cbcdca89b13a 100644
--- a/tests/binary-cache.sh
+++ b/tests/binary-cache.sh
@@ -52,9 +52,6 @@ export _NIX_FORCE_HTTP_BINARY_CACHE_STORE=1
 basicTests
 
 
-unset _NIX_FORCE_HTTP_BINARY_CACHE_STORE
-
-
 # Test whether Nix notices if the NAR doesn't match the hash in the NAR info.
 clearStore
 
@@ -86,11 +83,13 @@ clearStore
 nix-build --substituters "file://$cacheDir" dependencies.nix --dry-run # get info
 
 mkdir $cacheDir/tmp
-mv $cacheDir/*.nar* $cacheDir/tmp/
+mv $cacheDir/nar $cacheDir/nar2
 
-nix-build --substituters "file://$cacheDir" dependencies.nix -o $TEST_ROOT/result --fallback
+(! nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result)
 
-mv $cacheDir/tmp/* $cacheDir/
+nix-build --substituters "file://$cacheDir" --no-require-sigs dependencies.nix -o $TEST_ROOT/result --fallback
+
+mv $cacheDir/nar2 $cacheDir/nar
 
 
 # Test whether building works if the binary cache contains an
@@ -107,6 +106,7 @@ if [ -n "$HAVE_SODIUM" ]; then
 
 # Create a signed binary cache.
 clearCache
+clearCacheCache
 
 declare -a res=($(nix-store --generate-binary-cache-key test.nixos.org-1 $TEST_ROOT/sk1 $TEST_ROOT/pk1 ))
 publicKey="$(cat $TEST_ROOT/pk1)"
@@ -117,7 +117,7 @@ badKey="$(cat $TEST_ROOT/pk2)"
 res=($(nix-store --generate-binary-cache-key foo.nixos.org-1 $TEST_ROOT/sk3 $TEST_ROOT/pk3))
 otherKey="$(cat $TEST_ROOT/pk3)"
 
-nix copy --to file://$cacheDir?secret-key=$TEST_ROOT/sk1 $outPath
+_NIX_FORCE_HTTP_BINARY_CACHE_STORE= nix copy --to file://$cacheDir?secret-key=$TEST_ROOT/sk1 $outPath
 
 
 # Downloading should fail if we don't provide a key.