aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/ca/nix-copy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/ca/nix-copy.sh')
-rwxr-xr-xtests/functional/ca/nix-copy.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/functional/ca/nix-copy.sh b/tests/functional/ca/nix-copy.sh
new file mode 100755
index 000000000..7a8307a4e
--- /dev/null
+++ b/tests/functional/ca/nix-copy.sh
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+source common.sh
+
+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