about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-01T13·15+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-06-01T14·24+0200
commitcf198952d02aae5585e9bb895577b5b4e7b25707 (patch)
tree2161ec8760bf9d2ca64c14c1440e7db31bb1d1be /tests
parent7850d3d27910c30232dd09dd86ee8afdaad26b90 (diff)
HttpBinaryCacheStore: Fix caching of WantMassQuery
Also, test HttpBinaryCacheStore in addition to LocalBinaryCacheStore.
Diffstat (limited to 'tests')
-rw-r--r--tests/binary-cache.sh52
1 files changed, 34 insertions, 18 deletions
diff --git a/tests/binary-cache.sh b/tests/binary-cache.sh
index 48bc62d311de..96cab6ad4269 100644
--- a/tests/binary-cache.sh
+++ b/tests/binary-cache.sh
@@ -9,34 +9,50 @@ outPath=$(nix-build dependencies.nix --no-out-link)
 nix-push --dest $cacheDir $outPath
 
 
-# By default, a binary cache doesn't support "nix-env -qas", but does
-# support installation.
-clearStore
-clearCacheCache
+basicTests() {
 
-export _NIX_CACHE_FILE_URLS=1
+    # By default, a binary cache doesn't support "nix-env -qas", but does
+    # support installation.
+    clearStore
+    clearCacheCache
 
-nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---"
+    nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "---"
 
-nix-store --option binary-caches "file://$cacheDir" -r $outPath
+    nix-store --option binary-caches "file://$cacheDir" -r $outPath
 
-[ -x $outPath/program ]
+    [ -x $outPath/program ]
 
 
-# But with the right configuration, "nix-env -qas" should also work.
-clearStore
-clearCacheCache
-echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info
+    # But with the right configuration, "nix-env -qas" should also work.
+    clearStore
+    clearCacheCache
+    echo "WantMassQuery: 1" >> $cacheDir/nix-cache-info
+
+    nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S"
+    nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S"
+
+    x=$(nix-env -f dependencies.nix -qas \* --prebuilt-only)
+    [ -z "$x" ]
+
+    nix-store --option binary-caches "file://$cacheDir" -r $outPath
+
+    nix-store --check-validity $outPath
+    nix-store -qR $outPath | grep input-2
+
+    echo "WantMassQuery: 0" >> $cacheDir/nix-cache-info
+}
+
+
+# Test LocalBinaryCacheStore.
+basicTests
 
-nix-env --option binary-caches "file://$cacheDir" -f dependencies.nix -qas \* | grep -- "--S"
 
-x=$(nix-env -f dependencies.nix -qas \* --prebuilt-only)
-[ -z "$x" ]
+# Test HttpBinaryCacheStore.
+export _NIX_FORCE_HTTP_BINARY_CACHE_STORE=1
+basicTests
 
-nix-store --option binary-caches "file://$cacheDir" -r $outPath
 
-nix-store --check-validity $outPath
-nix-store -qR $outPath | grep input-2
+unset _NIX_FORCE_HTTP_BINARY_CACHE_STORE
 
 
 # Test whether Nix notices if the NAR doesn't match the hash in the NAR info.