Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
7851a2c6
Unverified
Commit
7851a2c6
authored
2 years ago
by
David Robertson
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
CI: Get the portdb job to run under poetry (#12412)
parent
78e4d96a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.ci/scripts/test_synapse_port_db.sh
+12
-18
12 additions, 18 deletions
.ci/scripts/test_synapse_port_db.sh
.github/workflows/tests.yml
+2
-1
2 additions, 1 deletion
.github/workflows/tests.yml
changelog.d/12412.misc
+1
-0
1 addition, 0 deletions
changelog.d/12412.misc
with
15 additions
and
19 deletions
.ci/scripts/test_synapse_port_db.sh
+
12
−
18
View file @
7851a2c6
#!/usr/bin/env bash
#!/usr/bin/env bash
#
#
# Test script for 'synapse_port_db'.
# Test script for 'synapse_port_db'.
# -
sets up
synapse and
deps
# -
configures
synapse and
a postgres server.
# - runs the port script on a prepopulated test sqlite db
# - runs the port script on a prepopulated test sqlite db
# - also runs it against an new sqlite db
# - also runs it against an new sqlite db
#
# Expects Synapse to have been already installed with `poetry install --extras postgres`.
# Expects `poetry` to be available on the `PATH`.
set
-xe
set
-xe
cd
"
$(
dirname
"
$0
"
)
/../.."
cd
"
$(
dirname
"
$0
"
)
/../.."
echo
"--- Install dependencies"
# Install dependencies for this test.
pip
install
psycopg2 coverage coverage-enable-subprocess
# Install Synapse itself. This won't update any libraries.
pip
install
-e
.
echo
"--- Generate the signing key"
echo
"--- Generate the signing key"
# Generate the server's signing key.
# Generate the server's signing key.
p
ython
-m
synapse
.app.
homeserver
--generate-keys
-c
.ci/sqlite-config.yaml
p
oetry run
synapse
_
homeserver
--generate-keys
-c
.ci/sqlite-config.yaml
echo
"--- Prepare test database"
echo
"--- Prepare test database"
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
update_synapse_database
--database-config
.ci/sqlite-config.yaml
--run-background-updates
poetry run
update_synapse_database
--database-config
.ci/sqlite-config.yaml
--run-background-updates
# Create the PostgreSQL database.
# Create the PostgreSQL database.
.ci/scripts/postgres_exec.py
"CREATE DATABASE synapse"
poetry run
.ci/scripts/postgres_exec.py
"CREATE DATABASE synapse"
echo
"+++ Run synapse_port_db against test database"
echo
"+++ Run synapse_port_db against test database"
# TODO: this invocation of synapse_port_db (and others below) used to be prepended with `coverage run`,
# TODO: this invocation of synapse_port_db (and others below) used to be prepended with `coverage run`,
# but coverage seems unable to find the entrypoints installed by `pip install -e .`.
# but coverage seems unable to find the entrypoints installed by `pip install -e .`.
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
poetry run
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
# We should be able to run twice against the same database.
# We should be able to run twice against the same database.
echo
"+++ Run synapse_port_db a second time"
echo
"+++ Run synapse_port_db a second time"
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
poetry run
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
#####
#####
...
@@ -48,12 +42,12 @@ echo "--- Prepare empty SQLite database"
...
@@ -48,12 +42,12 @@ echo "--- Prepare empty SQLite database"
# we do this by deleting the sqlite db, and then doing the same again.
# we do this by deleting the sqlite db, and then doing the same again.
rm
.ci/test_db.db
rm
.ci/test_db.db
update_synapse_database
--database-config
.ci/sqlite-config.yaml
--run-background-updates
poetry run
update_synapse_database
--database-config
.ci/sqlite-config.yaml
--run-background-updates
# re-create the PostgreSQL database.
# re-create the PostgreSQL database.
.ci/scripts/postgres_exec.py
\
poetry run
.ci/scripts/postgres_exec.py
\
"DROP DATABASE synapse"
\
"DROP DATABASE synapse"
\
"CREATE DATABASE synapse"
"CREATE DATABASE synapse"
echo
"+++ Run synapse_port_db against empty database"
echo
"+++ Run synapse_port_db against empty database"
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
poetry run
synapse_port_db
--sqlite-database
.ci/test_db.db
--postgres-config
.ci/postgres-config.yaml
This diff is collapsed.
Click to expand it.
.github/workflows/tests.yml
+
2
−
1
View file @
7851a2c6
...
@@ -307,9 +307,10 @@ jobs:
...
@@ -307,9 +307,10 @@ jobs:
steps
:
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
run
:
sudo apt-get -qq install xmlsec1
-
run
:
sudo apt-get -qq install xmlsec1
-
uses
:
actions
/setup-python@v
2
-
uses
:
matrix-org
/setup-python
-poetry
@v
1
with
:
with
:
python-version
:
${{ matrix.python-version }}
python-version
:
${{ matrix.python-version }}
extras
:
"
postgres"
-
run
:
.ci/scripts/test_synapse_port_db.sh
-
run
:
.ci/scripts/test_synapse_port_db.sh
complement
:
complement
:
...
...
This diff is collapsed.
Click to expand it.
changelog.d/12412.misc
0 → 100644
+
1
−
0
View file @
7851a2c6
Run the CI portdb script in the locked poetry environment.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment