Skip to content

Commit

Permalink
Add a test for the substitution of CA derivations
Browse files Browse the repository at this point in the history
  • Loading branch information
thufschmitt committed Oct 27, 2020
1 parent 7a5d86e commit b915a9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
20 changes: 16 additions & 4 deletions tests/content-addressed-remote-cache.sh
Expand Up @@ -4,11 +4,23 @@ source common.sh

clearStore
clearCache
clearCache

export REMOTE_STORE=file://$cacheDir

commonFlags=(--experimental-features 'ca-derivations ca-references nix-command')
commonFlags=( \
./content-addressed.nix -A transitivelyDependentCA \
--arg seed 1 \
--experimental-features 'ca-derivations ca-references nix-command' \
--no-out-link \
)

drvPath=$(nix-instantiate "${commonFlags[@]}" ./content-addressed.nix -A transitivelyDependentCA --arg seed 1)
nix copy "${commonFlags[@]}" --to file://$cacheDir $drvPath\!out
nix-build "${commonFlags[@]}" --post-build-hook $PWD/push-to-store.sh

clearStore
nix copy "${commonFlags[@]}" --from file://$cacheDir $drvPath\!out --no-require-sigs
# XXX: The `grep` call is a work around the fact that `-j0` currently doesn't
# take the possibility that drvs might be resolved into account, so would fail
# because Nix can't know *a priori* that everything is already in the binary
# cache
nix-build "${commonFlags[@]}" --no-require-sigs --substituters file://$cacheDir |& \
(! grep -q 'Building a')
1 change: 1 addition & 0 deletions tests/local.mk
Expand Up @@ -35,6 +35,7 @@ nix_tests = \
recursive.sh \
describe-stores.sh \
flakes.sh \
content-addressed-remote-cache.sh \
content-addressed.sh
# parallel.sh
# build-remote-content-addressed-fixed.sh \
Expand Down
2 changes: 1 addition & 1 deletion tests/push-to-store.sh
Expand Up @@ -2,4 +2,4 @@
set -x

echo Pushing "$OUTPUTS" to "$REMOTE_STORE"
printf "%s" "$OUTPUTS" | xargs -d: nix copy --to "$REMOTE_STORE" --no-require-sigs
printf "%s" "$OUTPUTS" | xargs nix copy --experimental-features 'ca-derivations ca-references nix-command' --to "$REMOTE_STORE" --no-require-sigs

0 comments on commit b915a9a

Please sign in to comment.