Files
dotfiles-public/.tests/lab/check-verbatim.sh
T
bcherb2 a001406a33 test: container lab for the two-tier apply
A disposable ubuntu container, a fake private tier and a fake bootstrap
endpoint, so the whole documented path — chezmoi init --apply, dotup pick,
dotup private, cmp apply, dotsecrets — can run end to end without touching a
real machine or a real credential. The fake tier mirrors the real one's
structure (seven secrets and one alias) because dotsecrets is copied verbatim
and the "8 exports, not 7" assertion depends on that cardinality; its ids are
sequential and obviously synthetic.

check-verbatim.sh keeps the fake tier's copies of shipped files honest, and
snapshot.sh records file modes so a 644 where a 600 belongs is a diff.
2026-08-21 22:34:53 -04:00

23 lines
902 B
Bash
Executable File

#!/bin/sh
# The fake private repo copies three files verbatim from the real one, so the
# scenarios measure the shipping implementation rather than a paraphrase of it.
# A verbatim copy silently stops being verbatim the moment the original is
# edited -- which happened within the hour of creating it. Check, don't hope.
set -eu
cd "$(dirname "$0")"
REAL=${1:-/home/dev/code/dotfiles-private}
rc=0
for f in .chezmoiignore run_after_50-secrets.sh.tmpl \
dot_local/bin/private_executable_dotsecrets.tmpl; do
if [ ! -f "$REAL/$f" ]; then
echo "MISSING in the real repo: $f" >&2; rc=1; continue
fi
if ! diff -q "$REAL/$f" "fake-private/$f" >/dev/null; then
echo "DRIFTED: fake-private/$f no longer matches $REAL/$f" >&2
echo " fix: cp '$REAL/$f' '$PWD/fake-private/$f'" >&2
rc=1
fi
done
[ "$rc" -eq 0 ] && echo "fake-private: all three verbatim copies match the real repo"
exit $rc