2021-03-25 17:53:54 +01:00
|
|
|
#!/usr/bin/env bash
|
2018-09-20 10:12:45 +02:00
|
|
|
|
|
|
|
# This script runs the PostgreSQL tests inside a Docker container. It expects
|
|
|
|
# the relevant source files to be mounted into /src (done automatically by the
|
|
|
|
# caller script). It will set up the database, run it, and then use the tox
|
|
|
|
# configuration to run the tests.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Set PGUSER so Synapse's tests know what user to connect to the database with
|
|
|
|
export PGUSER=postgres
|
|
|
|
|
2021-09-24 16:27:09 +02:00
|
|
|
# Start the database
|
|
|
|
sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl -w -D /var/lib/postgresql/data start
|
2018-09-20 10:12:45 +02:00
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
cd /src
|
|
|
|
export TRIAL_FLAGS="-j 4"
|
2021-09-24 16:27:09 +02:00
|
|
|
tox --workdir=./.tox-pg-container -e py36-postgres "$@"
|