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

Commit 7d90d6c

Browse files
authored
Run complement with Synapse workers manually. (#10039)
Adds an option to complement.sh to run Synapse in worker mode (instead of the default monolith mode).
1 parent 7adcb20 commit 7d90d6c

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

changelog.d/10039.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix running complement tests with Synapse workers.

docker/configure_workers_and_start.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,18 @@
184184
"""
185185

186186
NGINX_LOCATION_CONFIG_BLOCK = """
187-
location ~* {endpoint} {
187+
location ~* {endpoint} {{
188188
proxy_pass {upstream};
189189
proxy_set_header X-Forwarded-For $remote_addr;
190190
proxy_set_header X-Forwarded-Proto $scheme;
191191
proxy_set_header Host $host;
192-
}
192+
}}
193193
"""
194194

195195
NGINX_UPSTREAM_CONFIG_BLOCK = """
196-
upstream {upstream_worker_type} {
196+
upstream {upstream_worker_type} {{
197197
{body}
198-
}
198+
}}
199199
"""
200200

201201

scripts-dev/complement.sh

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
# checkout by setting the COMPLEMENT_DIR environment variable to the
1111
# filepath of a local Complement checkout.
1212
#
13+
# By default Synapse is run in monolith mode. This can be overridden by
14+
# setting the WORKERS environment variable.
15+
#
1316
# A regular expression of test method names can be supplied as the first
1417
# argument to the script. Complement will then only run those tests. If
1518
# no regex is supplied, all tests are run. For example;
@@ -32,10 +35,26 @@ if [[ -z "$COMPLEMENT_DIR" ]]; then
3235
echo "Checkout available at 'complement-master'"
3336
fi
3437

38+
# If we're using workers, modify the docker files slightly.
39+
if [[ -n "$WORKERS" ]]; then
40+
BASE_IMAGE=matrixdotorg/synapse-workers
41+
BASE_DOCKERFILE=docker/Dockerfile-workers
42+
export COMPLEMENT_BASE_IMAGE=complement-synapse-workers
43+
COMPLEMENT_DOCKERFILE=SynapseWorkers.Dockerfile
44+
# And provide some more configuration to complement.
45+
export COMPLEMENT_CA=true
46+
export COMPLEMENT_VERSION_CHECK_ITERATIONS=500
47+
else
48+
BASE_IMAGE=matrixdotorg/synapse
49+
BASE_DOCKERFILE=docker/Dockerfile
50+
export COMPLEMENT_BASE_IMAGE=complement-synapse
51+
COMPLEMENT_DOCKERFILE=Synapse.Dockerfile
52+
fi
53+
3554
# Build the base Synapse image from the local checkout
36-
docker build -t matrixdotorg/synapse -f docker/Dockerfile .
55+
docker build -t $BASE_IMAGE -f "$BASE_DOCKERFILE" .
3756
# Build the Synapse monolith image from Complement, based on the above image we just built
38-
docker build -t complement-synapse -f "$COMPLEMENT_DIR/dockerfiles/Synapse.Dockerfile" "$COMPLEMENT_DIR/dockerfiles"
57+
docker build -t $COMPLEMENT_BASE_IMAGE -f "$COMPLEMENT_DIR/dockerfiles/$COMPLEMENT_DOCKERFILE" "$COMPLEMENT_DIR/dockerfiles"
3958

4059
cd "$COMPLEMENT_DIR"
4160

@@ -46,4 +65,4 @@ if [[ -n "$1" ]]; then
4665
fi
4766

4867
# Run the tests!
49-
COMPLEMENT_BASE_IMAGE=complement-synapse go test -v -tags synapse_blacklist,msc2946,msc3083 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests
68+
go test -v -tags synapse_blacklist,msc2946,msc3083 -count=1 $EXTRA_COMPLEMENT_ARGS ./tests

0 commit comments

Comments
 (0)