commit
31849411a8
1578 files changed
+290463
No files matched your search
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run the opt-in CP4 PostgreSQL infrastructure smoke through the same Flyway
|
||||
# and Spring repository code used by the application. The JUnit gate validates
|
||||
# the approved legacy V001 coexistence shape before any write, migrates V1-V14,
|
||||
# restarts independent application contexts, verifies durable claim/fencing plus
|
||||
# the controlled-Provider Layer 3 path, and removes all synthetic source-rooted rows.
|
||||
set -euo pipefail
|
||||
|
||||
required_variables=(
|
||||
TH_HOTEL_BOOKING_PG_URL
|
||||
TH_HOTEL_BOOKING_PG_USERNAME
|
||||
TH_HOTEL_BOOKING_PG_PASSWORD
|
||||
TH_HOTEL_BOOKING_PG_SMOKE_DATABASE
|
||||
)
|
||||
for variable_name in "${required_variables[@]}"; do
|
||||
if [[ -z "${!variable_name:-}" ]]; then
|
||||
echo "${variable_name} is required through the deployment Secret environment." >&2
|
||||
exit 64
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${TH_HOTEL_BOOKING_PG_SMOKE_APPROVED:-false}" != 'true' ]]; then
|
||||
echo 'Set TH_HOTEL_BOOKING_PG_SMOKE_APPROVED=true only for an explicitly approved non-production database.' >&2
|
||||
exit 65
|
||||
fi
|
||||
|
||||
case "${TH_HOTEL_BOOKING_PG_URL}" in
|
||||
jdbc:postgresql://*) ;;
|
||||
postgresql://*)
|
||||
export TH_HOTEL_BOOKING_PG_URL="jdbc:${TH_HOTEL_BOOKING_PG_URL}"
|
||||
;;
|
||||
postgres://*)
|
||||
export TH_HOTEL_BOOKING_PG_URL="jdbc:postgresql://${TH_HOTEL_BOOKING_PG_URL#postgres://}"
|
||||
;;
|
||||
*)
|
||||
echo 'TH_HOTEL_BOOKING_PG_URL must be a PostgreSQL JDBC or PostgreSQL connection URL.' >&2
|
||||
exit 64
|
||||
;;
|
||||
esac
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
repository_root="$(cd "${script_dir}/.." && pwd)"
|
||||
for migration_version in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
|
||||
if ! compgen -G "${repository_root}/server/src/main/resources/db/booking-postgresql/migration/V${migration_version}__*.sql" >/dev/null; then
|
||||
echo "Canonical Booking PostgreSQL V${migration_version} migration is missing." >&2
|
||||
exit 66
|
||||
fi
|
||||
done
|
||||
|
||||
export TH_HOTEL_BOOKING_PG_SMOKE_ENABLED=true
|
||||
cd "${repository_root}/server"
|
||||
exec ./mvnw -Dtest=BookingPostgresCp4InfrastructureSmokeTest test
|
||||
Reference in new issue
Block a user