fix(vector): track packaged migrations in restore smoke
This commit is contained in:
@@ -390,10 +390,12 @@ PY
|
|||||||
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
|
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
|
||||||
"SELECT content_hash <> 'mutated-after-backup' FROM vectors.memory WHERE record_key = '$marker'")
|
"SELECT content_hash <> 'mutated-after-backup' FROM vectors.memory WHERE record_key = '$marker'")
|
||||||
test "$restored" = t
|
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 \
|
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
|
||||||
"SELECT count(*) = 3 FROM public.tht_vector_migrations")
|
"SELECT string_agg(version, ',' ORDER BY version) FROM public.tht_vector_migrations")
|
||||||
test "$pending" = t
|
test "$applied_migrations" = "$expected_migrations"
|
||||||
dimensions=$(docker exec -e PGPASSWORD="$new_bootstrap_password" "$restore_container" psql \
|
dimensions=$(docker exec -e PGPASSWORD="$new_bootstrap_password" "$restore_container" psql \
|
||||||
-XAt -U "$THT_VECTOR_BOOTSTRAP_USER" -d thoth --command \
|
-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
|
"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 -- '--single-transaction' "$tmp/restore.log"
|
||||||
grep -q -- '--exit-on-error' "$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."
|
echo "vector backup/restore filesystem, identity, and transaction contracts passed."
|
||||||
|
|||||||
Reference in New Issue
Block a user