mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-20 01:04:15 +00:00
test/e2e: key DB snapshots on the migration set, not the highest version
Batching reorders migrations. val/04-oauth carries e75b2e2 (commit 48 of the
range), whose migration is 0031, while 0028-0030 only arrive in batches 09, 12
and 14. So val/04 holds {..0027, 0031} and val/09 holds {..0027, 0028, 0031}.
Both have a max version of 0031, so keying the snapshot on the max would
restore val/04's database onto val/09 — a database missing 0028's schema while
schema_migrations claims otherwise.
Snapshots are now keyed on a fingerprint of every migration file present, which
distinguishes those two states. The max version is kept in the filename purely
so the directory stays readable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
f8d9ad7fe9
commit
c1604b9a04
+12
-4
@@ -63,11 +63,19 @@ fi
|
||||
# a naive wipe-per-switch costs an interactive `docker-credential-atcr login` on
|
||||
# every batch. Restoring a snapshot keeps the session alive across every batch
|
||||
# that shares a level.
|
||||
LEVEL=$(ls pkg/appview/db/migrations/*.yaml 2>/dev/null \
|
||||
| sed -E 's|.*/([0-9]{4})_.*|\1|' | sort -n | tail -1)
|
||||
# Key the snapshot on the FULL SET of migrations present, not the highest one.
|
||||
# Batching reorders migrations: val/04 carries e75b2e2, whose migration is 0031,
|
||||
# while 0028-0030 arrive later in batches 09, 12 and 14. So val/04 holds
|
||||
# {..0027, 0031} and val/09 holds {..0027, 0028, 0031} — both have a max of
|
||||
# 0031, and keying on the max would restore val/04's snapshot onto val/09, which
|
||||
# needs 0028's schema. The fingerprint distinguishes them.
|
||||
MIGS=$(ls pkg/appview/db/migrations/*.yaml 2>/dev/null \
|
||||
| sed -E 's|.*/([0-9]{4})_.*|\1|' | sort -n)
|
||||
LEVEL=$(printf '%s\n' "$MIGS" | tail -1)
|
||||
LEVEL=${LEVEL:-0000}
|
||||
SNAP="$SNAPDIR/ui.level-${LEVEL}.db"
|
||||
echo "==> branch migration level: ${LEVEL}"
|
||||
FINGERPRINT=$(printf '%s\n' "$MIGS" | md5sum | cut -c1-8)
|
||||
SNAP="$SNAPDIR/ui.level-${LEVEL}-${FINGERPRINT}.db"
|
||||
echo "==> branch migrations: max ${LEVEL}, set ${FINGERPRINT} ($(printf '%s\n' "$MIGS" | wc -l) files)"
|
||||
|
||||
echo "==> tearing down appview"
|
||||
docker compose rm -sf atcr-appview
|
||||
|
||||
Reference in New Issue
Block a user