2024-06-03 23:57:25 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-03-08 17:43:11 +02:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
clearStore
|
|
|
|
clearCache
|
|
|
|
|
2024-06-03 23:57:25 +03:00
|
|
|
nix-store --generate-binary-cache-key cache1.example.org "$TEST_ROOT/sk1" "$TEST_ROOT/pk1"
|
|
|
|
pk1=$(cat "$TEST_ROOT/pk1")
|
2021-03-08 17:43:11 +02:00
|
|
|
|
|
|
|
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"
|
2024-06-03 23:57:25 +03:00
|
|
|
nix copy -vvvv --to "$REMOTE_STORE" "$attrPath" --file ./content-addressed.nix \
|
2021-09-27 15:44:21 +03:00
|
|
|
--secret-key-files "$TEST_ROOT/sk1" --show-trace
|
2021-03-08 17:43:11 +02:00
|
|
|
|
|
|
|
ensureCorrectlyCopied "$attrPath"
|
|
|
|
|
|
|
|
# Ensure that we can copy back what we put in the store
|
|
|
|
clearStore
|
2024-06-03 23:57:25 +03:00
|
|
|
nix copy --from "$REMOTE_STORE" \
|
2021-03-08 17:43:11 +02:00
|
|
|
--file ./content-addressed.nix "$attrPath" \
|
2024-06-03 23:57:25 +03:00
|
|
|
--trusted-public-keys "$pk1"
|
2021-03-08 17:43:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for attrPath in rootCA dependentCA transitivelyDependentCA dependentNonCA dependentFixedOutput; do
|
|
|
|
testOneCopy "$attrPath"
|
|
|
|
done
|