From 00728c40ba61857d69f8c156ba26c81390ce8d36 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Thu, 20 Feb 2025 12:35:47 -0500 Subject: [PATCH] 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. --- release/schema-verifier/verify_deployed_sql_schema.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/release/schema-verifier/verify_deployed_sql_schema.sh b/release/schema-verifier/verify_deployed_sql_schema.sh index 563c513e4..b4e105565 100755 --- a/release/schema-verifier/verify_deployed_sql_schema.sh +++ b/release/schema-verifier/verify_deployed_sql_schema.sh @@ -69,6 +69,14 @@ PGPASSWORD=${db_password} pg_dump -h localhost -U "${db_user}" \ --exclude-table flyway_schema_history \ 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) # Clean up the raw_diff: # - Remove diff locations (e.g. "5,6c5,6): grep "^[<>]"