test_synapse_port_db.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. #
  3. # Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along
  4. # with additional dependencies needed for the test (such as coverage or the PostgreSQL
  5. # driver), update the schema of the test SQLite database and run background updates on it,
  6. # create an empty test database in PostgreSQL, then run the 'synapse_port_db' script to
  7. # test porting the SQLite database to the PostgreSQL database (with coverage).
  8. set -xe
  9. cd `dirname $0`/../..
  10. echo "--- Install dependencies"
  11. # Install dependencies for this test.
  12. pip install psycopg2 coverage coverage-enable-subprocess
  13. # Install Synapse itself. This won't update any libraries.
  14. pip install -e .
  15. echo "--- Generate the signing key"
  16. # Generate the server's signing key.
  17. python -m synapse.app.homeserver --generate-keys -c .buildkite/sqlite-config.yaml
  18. echo "--- Prepare the databases"
  19. # Make sure the SQLite3 database is using the latest schema and has no pending background update.
  20. scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
  21. # Create the PostgreSQL database.
  22. ./.buildkite/scripts/create_postgres_db.py
  23. echo "+++ Run synapse_port_db"
  24. # Run the script
  25. coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml