summary refs log tree commit diff
path: root/docker/run_pg_tests.sh
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-09-24 15:27:09 +0100
committerGitHub <noreply@github.com>2021-09-24 14:27:09 +0000
commitea01d4c2de65f29cf23e2d28786bfc10bd5fd881 (patch)
tree924c4dac5165effd769d2fc4ebdacdda3eb79ab9 /docker/run_pg_tests.sh
parentStop trying to auth/persist events whose auth events we do not have. (#10907) (diff)
downloadsynapse-ea01d4c2de65f29cf23e2d28786bfc10bd5fd881.tar.xz
Update postgresql testing script (#10906)
- Use sytest:bionic. Sytest:latest is two years old (do we want
  CI to push out latest at all?) and comes with Python 3.5, which we
  explictly no longer support. The script now runs under PostgreSQL 10
  as a result.
- Advertise script in the docs
- Move pg testing script to scripts-dev directory
- Write to host as the script's exector, not root

A few changes to make it speedier to re-run the tests:

- Create blank DB in the container, not the script, so we don't have to
  `initdb` each time
- Use a named volume to persist the tox environment, so we don't have to
  fetch and install a bunch of packages from PyPI each time

Co-authored-by: reivilibre <olivier@librepush.net>
Diffstat (limited to 'docker/run_pg_tests.sh')
-rwxr-xr-xdocker/run_pg_tests.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/docker/run_pg_tests.sh b/docker/run_pg_tests.sh
index 1fd08cb62b..58e2177d34 100755
--- a/docker/run_pg_tests.sh
+++ b/docker/run_pg_tests.sh
@@ -10,11 +10,10 @@ set -e
 # Set PGUSER so Synapse's tests know what user to connect to the database with
 export PGUSER=postgres
 
-# Initialise & start the database
-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
-su -c '/usr/lib/postgresql/9.6/bin/pg_ctl -w -D /var/lib/postgresql/data start' postgres
+# Start the database
+sudo -u postgres /usr/lib/postgresql/10/bin/pg_ctl -w -D /var/lib/postgresql/data start
 
 # Run the tests
 cd /src
 export TRIAL_FLAGS="-j 4"
-tox --workdir=/tmp -e py35-postgres
+tox --workdir=./.tox-pg-container -e py36-postgres "$@"