From b1711071d1a22a1c28448823634b0dc7212e4fe5 Mon Sep 17 00:00:00 2001 From: regnat Date: Thu, 22 Apr 2021 17:54:02 +0200 Subject: [PATCH] Add a regression test for #4725 --- tests/ca/substitute.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/ca/substitute.sh b/tests/ca/substitute.sh index b44fe499a..5d0fc6a87 100644 --- a/tests/ca/substitute.sh +++ b/tests/ca/substitute.sh @@ -8,7 +8,8 @@ sed -i 's/experimental-features .*/& ca-derivations ca-references/' "$NIX_CONF_D rm -rf $TEST_ROOT/binary_cache -export REMOTE_STORE=file://$TEST_ROOT/binary_cache +export REMOTE_STORE_DIR=$TEST_ROOT/binary_cache +export REMOTE_STORE=file://$REMOTE_STORE_DIR buildDrvs () { nix build --file ./content-addressed.nix -L --no-link "$@" @@ -22,3 +23,20 @@ buildDrvs --post-build-hook ../push-to-store.sh clearStore buildDrvs --substitute --substituters $REMOTE_STORE --no-require-sigs -j0 +# Same thing, but +# 1. With non-ca derivations +# 2. Erasing the realisations on the remote store +# +# Even in that case, realising the derivations should still produce the right +# realisations on the local store +# +# Regression test for #4725 +clearStore +nix build --file ../simple.nix -L --no-link --post-build-hook ../push-to-store.sh +clearStore +rm -r "$REMOTE_STORE_DIR/realisations" +nix build --file ../simple.nix -L --no-link --substitute --substituters "$REMOTE_STORE" --no-require-sigs -j0 +if [[ $(sqlite3 "$NIX_STATE_DIR/db/db.sqlite" 'select count(*) from Realisations') -eq 0 ]]; then + echo "Realisations not rebuilt" + exit 1 +fi