mirror of
https://github.com/maplibre/martin.git
synced 2024-12-22 14:21:39 +03:00
405d4b27a2
* on `--save-config`, only save configured `auto_publish` settings * alias `from_schemas` as `from_schema` * add integration testing for `auto_publish` * if integration test DB preloading fails, try to clean up the test DB * A few more info traces This change should benefit testing of the #790 cc: @Binabh
36 lines
1.8 KiB
Bash
Executable File
36 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
FIXTURES_DIR="$(dirname "$0")"
|
|
echo -e "\n\n\n"
|
|
echo "################################################################################################"
|
|
echo "Loading Martin test fixtures into '$PGDATABASE' as user '$PGUSER'"
|
|
echo "################################################################################################"
|
|
|
|
|
|
psql -P pager=off -v ON_ERROR_STOP=1 -c "CREATE EXTENSION IF NOT EXISTS postgis;"
|
|
# see https://github.com/postgis/docker-postgis/issues/187
|
|
psql -P pager=off -v ON_ERROR_STOP=1 -c "DROP SCHEMA IF EXISTS tiger CASCADE;"
|
|
psql -P pager=off -v ON_ERROR_STOP=1 -t -c "select version();"
|
|
psql -P pager=off -v ON_ERROR_STOP=1 -t -c "select PostGIS_Full_Version();"
|
|
|
|
# On error, make sure do delete all the tables we created
|
|
# TODO: see if we can have a fail-early service test to detect errors
|
|
trap 'echo -e "\n\n\n!!!!!!!!!!!!!!!!!!!!!!!!\n\nDELETING DB $PGDATABASE DUE TO AN ERROR!\n\n\n" && psql -c "DROP SCHEMA IF EXISTS "MixedCase" CASCADE; DROP SCHEMA IF EXISTS autodetect CASCADE;"' ERR
|
|
|
|
echo -e "\n\n\n"
|
|
echo "################################################################################################"
|
|
echo "Importing tables from $FIXTURES_DIR/tables"
|
|
echo "################################################################################################"
|
|
for sql_file in "$FIXTURES_DIR"/tables/*.sql; do
|
|
psql -e -P pager=off -v ON_ERROR_STOP=1 -f "$sql_file"
|
|
done
|
|
|
|
echo -e "\n\n\n"
|
|
echo "################################################################################################"
|
|
echo "Importing functions from $FIXTURES_DIR/functions"
|
|
echo "################################################################################################"
|
|
for sql_file in "$FIXTURES_DIR"/functions/*.sql; do
|
|
psql -e -P pager=off -v ON_ERROR_STOP=1 -f "$sql_file"
|
|
done
|