Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 4045f74

Browse files
author
David Robertson
committed
CI: Fix the portdb job to run under poetry
1 parent 7732c49 commit 4045f74

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

.ci/scripts/test_synapse_port_db.sh

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,32 @@
55
# - runs the port script on a prepopulated test sqlite db
66
# - also runs it against an new sqlite db
77

8+
# Expects Synapse to have been already installed with `poetry install -e .[postgres]
89

910
set -xe
1011
cd "$(dirname "$0")/../.."
1112

12-
echo "--- Install dependencies"
13-
14-
# Install dependencies for this test.
15-
pip install psycopg2 coverage coverage-enable-subprocess
16-
17-
# Install Synapse itself. This won't update any libraries.
18-
pip install -e .
19-
2013
echo "--- Generate the signing key"
2114

2215
# Generate the server's signing key.
23-
python -m synapse.app.homeserver --generate-keys -c .ci/sqlite-config.yaml
16+
poetry run synapse_homeserver --generate-keys -c .ci/sqlite-config.yaml
2417

2518
echo "--- Prepare test database"
2619

2720
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
28-
update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
21+
poetry run update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
2922

3023
# Create the PostgreSQL database.
31-
.ci/scripts/postgres_exec.py "CREATE DATABASE synapse"
24+
poetry run .ci/scripts/postgres_exec.py "CREATE DATABASE synapse"
3225

3326
echo "+++ Run synapse_port_db against test database"
3427
# TODO: this invocation of synapse_port_db (and others below) used to be prepended with `coverage run`,
3528
# but coverage seems unable to find the entrypoints installed by `pip install -e .`.
36-
synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
29+
poetry run synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
3730

3831
# We should be able to run twice against the same database.
3932
echo "+++ Run synapse_port_db a second time"
40-
synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
33+
poetry run synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
4134

4235
#####
4336

@@ -48,12 +41,12 @@ echo "--- Prepare empty SQLite database"
4841
# we do this by deleting the sqlite db, and then doing the same again.
4942
rm .ci/test_db.db
5043

51-
update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
44+
poetry run update_synapse_database --database-config .ci/sqlite-config.yaml --run-background-updates
5245

5346
# re-create the PostgreSQL database.
54-
.ci/scripts/postgres_exec.py \
47+
poetry run .ci/scripts/postgres_exec.py \
5548
"DROP DATABASE synapse" \
5649
"CREATE DATABASE synapse"
5750

5851
echo "+++ Run synapse_port_db against empty database"
59-
synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml
52+
poetry run synapse_port_db --sqlite-database .ci/test_db.db --postgres-config .ci/postgres-config.yaml

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,10 @@ jobs:
307307
steps:
308308
- uses: actions/checkout@v2
309309
- run: sudo apt-get -qq install xmlsec1
310-
- uses: actions/setup-python@v2
310+
- uses: matrix-org/setup-python-poetry@v1
311311
with:
312312
python-version: ${{ matrix.python-version }}
313+
extras: "postgres"
313314
- run: .ci/scripts/test_synapse_port_db.sh
314315

315316
complement:

0 commit comments

Comments
 (0)