forked from MirrorHub/synapse
14504ad573
This adds: * a test sqlite database * a configuration file for the sqlite database * a configuration file for a postgresql database (using the credentials in `.buildkite/docker-compose.pyXX.pgXX.yaml`) as well as a new script named `.buildkite/scripts/test_synapse_port_db.sh` that: 1. installs Synapse 2. updates the test sqlite database to the latest schema and runs background updates on it 3. creates an empty postgresql database 4. run the `synapse_port_db` script to migrate the test sqlite database to the empty postgresql database (with coverage) Step `2` is done via a new script located at `scripts-dev/update_database`. The test sqlite database is extracted from a SyTest run, so that it can be considered as an actual homeserver's database with actual data in it.
29 lines
1.1 KiB
Bash
Executable file
29 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Test script for 'synapse_port_db', which creates a virtualenv, installs Synapse along
|
|
# with additional dependencies needed for the test (such as coverage or the PostgreSQL
|
|
# driver), update the schema of the test SQLite database and run background updates on it,
|
|
# create an empty test database in PostgreSQL, then run the 'synapse_port_db' script to
|
|
# test porting the SQLite database to the PostgreSQL database (with coverage).
|
|
|
|
set -xe
|
|
cd `dirname $0`/../..
|
|
|
|
# Create a virtualenv and use it.
|
|
virtualenv env
|
|
source env/bin/activate
|
|
|
|
# Install dependencies for this test.
|
|
pip install psycopg2 coverage coverage-enable-subprocess
|
|
|
|
# Install Synapse itself. This won't update any libraries.
|
|
pip install -e .
|
|
|
|
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
|
|
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
|
|
|
|
# Create the PostgreSQL database.
|
|
PGPASSWORD=postgres createdb -h postgres -U postgres synapse
|
|
|
|
# Run the script
|
|
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
|