diff options
author | regnat <rg@regnat.ovh> | 2020-12-15 09:37:05 +0100 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2021-02-25 17:19:18 +0100 |
commit | aead35531a0630b19e41348e103b2d105e2d8dd9 (patch) | |
tree | e021a97414b7d0269434d770e699a7e1a7c31c76 /tests/nix-copy-content-addressed.sh | |
parent | 2e199673a523fa81de31ffdd2a25976ce0814631 (diff) |
Add a test for the copy of CA paths
Diffstat (limited to 'tests/nix-copy-content-addressed.sh')
-rwxr-xr-x | tests/nix-copy-content-addressed.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/nix-copy-content-addressed.sh b/tests/nix-copy-content-addressed.sh new file mode 100755 index 000000000..2e0dea2d2 --- /dev/null +++ b/tests/nix-copy-content-addressed.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +source common.sh + +# Globally enable the ca derivations experimental flag +sed -i 's/experimental-features = .*/& ca-derivations ca-references/' "$NIX_CONF_DIR/nix.conf" + +export REMOTE_STORE_DIR="$TEST_ROOT/remote_store" +export REMOTE_STORE="file://$REMOTE_STORE_DIR" + +ensureCorrectlyCopied () { + attrPath="$1" + nix build --store "$REMOTE_STORE" --file ./content-addressed.nix "$attrPath" +} + +testOneCopy () { + clearStore + rm -rf "$REMOTE_STORE_DIR" + + attrPath="$1" + nix copy --to $REMOTE_STORE "$attrPath" --file ./content-addressed.nix + + ensureCorrectlyCopied "$attrPath" + + # Ensure that we can copy back what we put in the store + clearStore + nix copy --from $REMOTE_STORE \ + --file ./content-addressed.nix "$attrPath" \ + --no-check-sigs +} + +for attrPath in rootCA dependentCA transitivelyDependentCA dependentNonCA dependentFixedOutput; do + testOneCopy "$attrPath" +done |