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

Commit 2506dd7

Browse files
authored
Unit tests CI speedup (#14610)
1 parent be3a8a8 commit 2506dd7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ jobs:
197197
- run: sudo apt-get -qq install xmlsec1
198198
- name: Set up PostgreSQL ${{ matrix.job.postgres-version }}
199199
if: ${{ matrix.job.postgres-version }}
200+
# 1. Mount postgres data files onto a tmpfs in-memory filesystem to reduce overhead of docker's overlayfs layer.
201+
# 2. Expose the unix socket for postgres. This removes latency of using docker-proxy for connections.
200202
run: |
201203
docker run -d -p 5432:5432 \
204+
--tmpfs /var/lib/postgres:rw,size=6144m \
205+
--mount 'type=bind,src=/var/run/postgresql,dst=/var/run/postgresql' \
202206
-e POSTGRES_PASSWORD=postgres \
203207
-e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
204208
postgres:${{ matrix.job.postgres-version }}
@@ -220,10 +224,10 @@ jobs:
220224
if: ${{ matrix.job.postgres-version }}
221225
timeout-minutes: 2
222226
run: until pg_isready -h localhost; do sleep 1; done
223-
- run: poetry run trial --jobs=2 tests
227+
- run: poetry run trial --jobs=6 tests
224228
env:
225229
SYNAPSE_POSTGRES: ${{ matrix.job.database == 'postgres' || '' }}
226-
SYNAPSE_POSTGRES_HOST: localhost
230+
SYNAPSE_POSTGRES_HOST: /var/run/postgresql
227231
SYNAPSE_POSTGRES_USER: postgres
228232
SYNAPSE_POSTGRES_PASSWORD: postgres
229233
- name: Dump logs
@@ -292,7 +296,7 @@ jobs:
292296
python-version: '3.7'
293297
extras: "all test"
294298

295-
- run: poetry run trial -j2 tests
299+
- run: poetry run trial -j6 tests
296300
- name: Dump logs
297301
# Logs are most useful when the command fails, always include them.
298302
if: ${{ always() }}

changelog.d/14610.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Alter some unit test environment parameters to decrease time spent running tests.

0 commit comments

Comments
 (0)