Files
relspecgo/tests/dbtest/dbs/postgres.sh
T

17 lines
876 B
Bash

# Postgres container definition (sourced by dbtest.sh)
DB_NAME=postgres
DB_IMAGE=docker.io/library/postgres:16-alpine
DB_CONTAINER=relspec-test-postgres
DB_PORT=5439
DB_INTERNAL_PORT=5432
DB_ENV=(-e POSTGRES_USER=relspec -e POSTGRES_PASSWORD=relspec_test_password -e POSTGRES_DB=relspec_test)
DB_INIT_MOUNT="$ROOT/tests/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql"
DB_CONN_VAR=RELSPEC_TEST_PG_CONN
DB_CONN="postgres://relspec:relspec_test_password@localhost:5439/relspec_test"
DB_DEFAULT_PKGS="./pkg/readers/pgsql/ ./pkg/writers/pgsql/ ./pkg/writers/sqlexec/"
db_ready() { rt exec "$DB_CONTAINER" pg_isready -U relspec -d relspec_test >/dev/null 2>&1; }
db_post_init() { :; }
db_shell() { rt exec -it "$DB_CONTAINER" psql -U relspec -d relspec_test "$@"; }
db_exec_file() { rt exec -i "$DB_CONTAINER" psql -v ON_ERROR_STOP=1 -U relspec -d relspec_test < "$1"; }