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.
This commit is contained in:
1 parent
d1e3f8bce2
commit
a001406a33
22 files changed
+2809
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user