Skip to content

Commit 0b01f2b

Browse files
committed
Merge remote-tracking branch 'upstream/release-v1.34.0'
2 parents 1fddcc0 + 13b0673 commit 0b01f2b

File tree

1,034 files changed

+18821
-7112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,034 files changed

+18821
-7112
lines changed

.buildkite/scripts/create_postgres_db.py

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
# Copyright 2019 The Matrix.org Foundation C.I.C.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
import sys
17+
18+
import psycopg2
19+
20+
# a very simple replacment for `psql`, to make up for the lack of the postgres client
21+
# libraries in the synapse docker image.
22+
23+
# We use "postgres" as a database because it's bound to exist and the "synapse" one
24+
# doesn't exist yet.
25+
db_conn = psycopg2.connect(
26+
user="postgres", host="postgres", password="postgres", dbname="postgres"
27+
)
28+
db_conn.autocommit = True
29+
cur = db_conn.cursor()
30+
for c in sys.argv[1:]:
31+
cur.execute(c)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
# this script is run by buildkite in a plain `xenial` container; it installs the
4-
# minimal requirements for tox and hands over to the py35-old tox environment.
3+
# this script is run by buildkite in a plain `bionic` container; it installs the
4+
# minimal requirements for tox and hands over to the py3-old tox environment.
55

66
set -ex
77

88
apt-get update
9-
apt-get install -y python3.5 python3.5-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
9+
apt-get install -y python3 python3-dev python3-pip libxml2-dev libxslt-dev xmlsec1 zlib1g-dev tox
1010

1111
export LANG="C.UTF-8"
1212

1313
# Prevent virtualenv from auto-updating pip to an incompatible version
1414
export VIRTUALENV_NO_DOWNLOAD=1
1515

16-
exec tox -e py35-old,combine
16+
exec tox -e py3-old,combine
Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
#
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).
3+
# Test script for 'synapse_port_db'.
4+
# - sets up synapse and deps
5+
# - runs the port script on a prepopulated test sqlite db
6+
# - also runs it against an new sqlite db
7+
88

99
set -xe
1010
cd `dirname $0`/../..
@@ -22,15 +22,32 @@ echo "--- Generate the signing key"
2222
# Generate the server's signing key.
2323
python -m synapse.app.homeserver --generate-keys -c .buildkite/sqlite-config.yaml
2424

25-
echo "--- Prepare the databases"
25+
echo "--- Prepare test database"
2626

2727
# Make sure the SQLite3 database is using the latest schema and has no pending background update.
2828
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
2929

3030
# Create the PostgreSQL database.
31-
./.buildkite/scripts/create_postgres_db.py
31+
./.buildkite/scripts/postgres_exec.py "CREATE DATABASE synapse"
32+
33+
echo "+++ Run synapse_port_db against test database"
34+
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml
35+
36+
#####
37+
38+
# Now do the same again, on an empty database.
39+
40+
echo "--- Prepare empty SQLite database"
41+
42+
# we do this by deleting the sqlite db, and then doing the same again.
43+
rm .buildkite/test_db.db
44+
45+
scripts-dev/update_database --database-config .buildkite/sqlite-config.yaml
3246

33-
echo "+++ Run synapse_port_db"
47+
# re-create the PostgreSQL database.
48+
./.buildkite/scripts/postgres_exec.py \
49+
"DROP DATABASE synapse" \
50+
"CREATE DATABASE synapse"
3451

35-
# Run the script
52+
echo "+++ Run synapse_port_db against empty database"
3653
coverage run scripts/synapse_port_db --sqlite-database .buildkite/test_db.db --postgres-config .buildkite/postgres-config.yaml

.git-blame-ignore-revs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Black reformatting (#5482).
2+
32e7c9e7f20b57dd081023ac42d6931a8da9b3a3
3+
4+
# Target Python 3.5 with black (#8664).
5+
aff1eb7c671b0a3813407321d2702ec46c71fa56
6+
7+
# Update black to 20.8b1 (#9381).
8+
0a00b7ff14890987f09112a2ae696c61001e6cf1

0 commit comments

Comments
 (0)