aboutsummaryrefslogtreecommitdiff
path: root/tests/nix-copy-content-addressed.sh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-02-27 05:46:59 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-02-27 05:46:59 +0000
commit7863036634ccb07e1933cd0b106fc27d5c073004 (patch)
tree36bf7f334b739269eb741813a68adde714f67293 /tests/nix-copy-content-addressed.sh
parent90d76fa399de4e207ea14ec4c0dd65434f60c152 (diff)
parentf0ad29acc1f2c9e82679c3af434a8bf185f36b94 (diff)
Merge remote-tracking branch 'obsidian/path-info' into ca-drv-exotic
Diffstat (limited to 'tests/nix-copy-content-addressed.sh')
-rwxr-xr-xtests/nix-copy-content-addressed.sh34
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