fix(vector): track packaged migrations in restore smoke

This commit is contained in:
2026-07-12 07:49:58 +02:00
parent 09d50ac9bb
commit ee92ef45ab
2 changed files with 15 additions and 3 deletions
+5 -3
View File
@@ -390,10 +390,12 @@ PY
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
"SELECT content_hash <> 'mutated-after-backup' FROM vectors.memory WHERE record_key = '$marker'")
test "$restored" = t
pending=$(docker exec -e PGPASSWORD="$new_bootstrap_password" "$restore_container" psql \
expected_migrations=$(find harness/tht/migrations/vector -type f -name '[0-9][0-9][0-9]_*.sql' \
-exec basename {} \; | sed 's/_.*//' | sort | paste -sd, -)
applied_migrations=$(docker exec -e PGPASSWORD="$new_bootstrap_password" "$restore_container" psql \
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
"SELECT count(*) = 3 FROM public.tht_vector_migrations")
test "$pending" = t
"SELECT string_agg(version, ',' ORDER BY version) FROM public.tht_vector_migrations")
test "$applied_migrations" = "$expected_migrations"
dimensions=$(docker exec -e PGPASSWORD="$new_bootstrap_password" "$restore_container" psql \
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
"SELECT count(*) = 3 FROM pg_attribute a JOIN pg_class c ON c.oid=a.attrelid
@@ -86,4 +86,14 @@ PATH="$fakebin:$PATH" RESTORE_LOG="$tmp/restore.log" ./scripts/vector-restore.sh
grep -q -- '--single-transaction' "$tmp/restore.log"
grep -q -- '--exit-on-error' "$tmp/restore.log"
# The live restore smoke must follow the packaged migration set instead of a stale
# hard-coded count when a new migration is added.
if grep -Fq 'SELECT count(*) = 3 FROM public.tht_vector_migrations' \
scripts/local-vector-smoke.sh; then
echo "local vector smoke hard-codes the pre-004 migration count" >&2
exit 1
fi
grep -Fq 'expected_migrations=' scripts/local-vector-smoke.sh
grep -Fq 'applied_migrations=' scripts/local-vector-smoke.sh
echo "vector backup/restore filesystem, identity, and transaction contracts passed."