test(35): self-test compares the planted consumer's go.mod

- the workspace-modfile case copies the planted consumer's go.mod before the
  modfile run and compares it after with cmp -s (IN-03)
- drops the git status check on the dirty-sibling fixture, which asserted
  against the wrong repository; the replace-line grep stays
This commit is contained in:
Jakub Zych
2026-11-14 16:00:23 +01:00
parent 54617f78d1
commit e54be76cf0

View File

@@ -609,6 +609,8 @@ self_test_consumers() {
echo "refuse: self-test workspace_check refused a consumer that resolves the framework to the expected checkout" >&2
return 1
fi
# A copy of the planted consumer's go.mod, compared after the modfile run.
cp "$consumer/go.mod" "$tmp/consumer-go.mod.before"
rc=0
out="$(ROOT="$fw" GOWORK=off GOPROXY=off GOFLAGS= GOTOOLCHAIN=local workspace_check "$consumer" "-mod=mod -modfile=$mod/go.mod" 2>&1)" || rc=$?
if [[ "$rc" -eq 0 ]] || ! grep -q "^refuse: $consumer resolves git.golem15.com/golem15/summercms to .*elsewhere" <<<"$out"; then
@@ -616,7 +618,7 @@ self_test_consumers() {
echo "refuse: self-test workspace_check under a scratch modfile accepted a framework that resolves elsewhere (exit $rc)" >&2
return 1
fi
if [[ -n "$(git -c safe.directory='*' -C "$repo" status --porcelain -- go.mod)" ]] || ! grep -q '=> ../framework' "$consumer/go.mod"; then
if ! cmp -s "$tmp/consumer-go.mod.before" "$consumer/go.mod" || ! grep -q '=> ../framework' "$consumer/go.mod"; then
echo "refuse: self-test the modfile run wrote the planted consumer's go.mod" >&2
return 1
fi