M12.4: qualify migration ownership across TLS path loss
Foundation / checks (ecs) (push) Successful in 2m29s
Foundation / checks (deploy) (push) Successful in 4m8s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 18m9s
Foundation / checks (client) (push) Canceled after 18m8s
Foundation / checks (network) (push) Canceled after 18m7s
Foundation / checks (tsan) (push) Canceled after 15m39s
Foundation / checks (postgres) (push) Canceled after 18m13s

This commit is contained in:
dingo
2026-10-18 13:19:59 -04:00
parent 0f071f3f8b
commit e0a7c13f6b
16 changed files with 707 additions and 14 deletions
+25 -2
View File
@@ -3,6 +3,7 @@ set -euo pipefail
# Usage: postgres-check.sh [--full|--sanitizer|--suite-only] <evo-postgres-tests>
# postgres-check.sh --life-reservations-only [<evo-postgres-tests>]
# postgres-check.sh --population-only <evo-postgres-tests>
# postgres-check.sh --migration-faults <evo-postgres-tests> (private loopback TLS)
# --full (default) is the complete qualification: the C++ suite, the backup, DR and
# upgrade process checks, then the SQL-only migration, permission and checksum checks.
# --sanitizer keeps everything that runs the binaries built beside the test binary
@@ -12,6 +13,7 @@ set -euo pipefail
root="$(cd "$(dirname "$0")/../.." && pwd)"
mode=full
case "${1:-}" in
--migration-faults) mode=migration-faults; shift ;;
--population-only) mode=population; shift ;;
--full) shift ;;
--sanitizer) mode=sanitizer; shift ;;
@@ -41,9 +43,26 @@ test_dir="$(mktemp -d /tmp/evo-pg-test.XXXXXXXX)"
chmod 700 "$test_dir"
export PGHOST="$test_dir" PGPORT=55432 PGDATABASE=postgres PGUSER="$(id -un)"
unset PGHOSTADDR PGPASSWORD PGSERVICE PGSERVICEFILE
unset EVO_MIGRATION_TCP_PORT EVO_MIGRATION_CA
initdb -D "$test_dir/data" --no-locale --encoding=UTF8 --auth-local=trust --auth-host=reject > "$test_dir/init.log"
trap 'rc=$?; timing_summary "exit $rc" >&2; pg_ctl -D "$test_dir/data" -m immediate stop > /dev/null || true' EXIT
pg_ctl -D "$test_dir/data" -l "$test_dir/server.log" -o "-k $test_dir -p 55432 -c listen_addresses=''" -w start
if [ "$mode" = migration-faults ]; then
# One disposable cluster only; the owner remains Unix-socket-only. No production
# credential or adapter TLS exception. The relay forwards encrypted bytes.
openssl req -x509 -newkey rsa:2048 -nodes -days 1 -subj /CN=localhost \
-addext 'subjectAltName=DNS:localhost,IP:127.0.0.1' \
-keyout "$test_dir/server.key" -out "$test_dir/server.crt" > "$test_dir/tls.log" 2>&1
chmod 600 "$test_dir/server.key"
PGPORT="$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1])')"
export PGPORT EVO_MIGRATION_TCP_PORT="$PGPORT" EVO_MIGRATION_CA="$test_dir/server.crt"
printf '%s\n' 'local all all trust' \
'hostssl postgres evo_runtime_login 127.0.0.1/32 trust' \
'host all all 127.0.0.1/32 reject' 'host all all ::1/128 reject' > "$test_dir/data/pg_hba.conf"
pg_ctl -D "$test_dir/data" -l "$test_dir/server.log" \
-o "-k $test_dir -p $PGPORT -c listen_addresses=127.0.0.1 -c ssl=on -c ssl_cert_file=$test_dir/server.crt -c ssl_key_file=$test_dir/server.key" -w start
else
pg_ctl -D "$test_dir/data" -l "$test_dir/server.log" -o "-k $test_dir -p 55432 -c listen_addresses=''" -w start
fi
# Runtime group role receives grants; a separate login inherits only that role.
psql -X -v ON_ERROR_STOP=1 -c 'CREATE ROLE evo_runtime_test NOLOGIN' \
-c 'CREATE ROLE evo_runtime_login LOGIN IN ROLE evo_runtime_test'
@@ -58,7 +77,7 @@ if [ "$mode" = life-reservations ]; then
bash "$root/tools/ci/life-reservations-concurrency.sh"
exit 0
fi
if [ "$mode" = population ]; then
if [ "$mode" = population ] || [ "$mode" = migration-faults ]; then
phase population
"$1" --population-only
exit 0
@@ -85,6 +104,10 @@ if [ "$mode" = suite-only ]; then
echo "postgres-check[suite-only]: $1 passed; process and SQL checks run in --full"
exit 0
fi
if [ "$mode" = full ] || [ "$mode" = sanitizer ]; then
phase migration-partitions
bash "$root/tools/ci/postgres-check.sh" --migration-faults "$1"
fi
if [ "$mode" = full ]; then
phase life-reservations
psql -X -v ON_ERROR_STOP=1 -f "$root/tools/ci/life-reservations-check.sql" > /dev/null