summary refs log tree commit diff
path: root/scripts-dev
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 /scripts-dev
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 'scripts-dev')
-rwxr-xr-xscripts-dev/test_postgresql.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts-dev/test_postgresql.sh b/scripts-dev/test_postgresql.sh
new file mode 100755
index 0000000000..43cfa256e4
--- /dev/null
+++ b/scripts-dev/test_postgresql.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# This script builds the Docker image to run the PostgreSQL tests, and then runs
+# the tests. It uses a dedicated tox environment so that we don't have to
+# rebuild it each time.
+
+# Command line arguments to this script are forwarded to "tox" and then to "trial".
+
+set -e
+
+# Build, and tag
+docker build docker/ \
+  --build-arg "UID=$(id -u)" \
+  --build-arg "GID=$(id -g)" \
+  -f docker/Dockerfile-pgtests \
+  -t synapsepgtests
+
+# Run, mounting the current directory into /src
+docker run --rm -it -v "$(pwd):/src" -v synapse-pg-test-tox:/tox synapsepgtests "$@"