1
0

run_pg_tests.sh 773 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. # This script runs the PostgreSQL tests inside a Docker container. It expects
  3. # the relevant source files to be mounted into /src (done automatically by the
  4. # caller script). It will set up the database, run it, and then use the tox
  5. # configuration to run the tests.
  6. set -e
  7. # Set PGUSER so Synapse's tests know what user to connect to the database with
  8. export PGUSER=postgres
  9. # Initialise & start the database
  10. su -c '/usr/lib/postgresql/9.6/bin/initdb -D /var/lib/postgresql/data -E "UTF-8" --lc-collate="en_US.UTF-8" --lc-ctype="en_US.UTF-8" --username=postgres' postgres
  11. su -c '/usr/lib/postgresql/9.6/bin/pg_ctl -w -D /var/lib/postgresql/data start' postgres
  12. # Run the tests
  13. cd /src
  14. export TRIAL_FLAGS="-j 4"
  15. tox --workdir=/tmp -e py35-postgres