1
0
mirror of https://github.com/google/nomulus synced 2025-12-23 06:15:42 +00:00

Abort schema verifier when pg_dump fails (#2681)

Failed pg_dump may not leave a file, failing the subsequent diffing and
causing the verifier to return success.

The verifier should abort in this case.
This commit is contained in:
Weimin Yu
2025-02-20 12:35:47 -05:00
committed by GitHub
parent 3f2a42ab8d
commit 00728c40ba

View File

@@ -69,6 +69,14 @@ PGPASSWORD=${db_password} pg_dump -h localhost -U "${db_user}" \
--exclude-table flyway_schema_history \ --exclude-table flyway_schema_history \
postgres postgres
if [ $? -ne 0 ]; then
echo "Failed to dump schema."
exit 1
else
echo "Schema dumped."
fi
raw_diff=$(diff /schema/nomulus.golden.sql /schema/nomulus.actual.sql) raw_diff=$(diff /schema/nomulus.golden.sql /schema/nomulus.actual.sql)
# Clean up the raw_diff: # Clean up the raw_diff:
# - Remove diff locations (e.g. "5,6c5,6): grep "^[<>]" # - Remove diff locations (e.g. "5,6c5,6): grep "^[<>]"