Skip to content

Commit ab23d1a

Browse files
committed
Configure nextest to run database tests serially
1 parent 21e2c36 commit ab23d1a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

.config/nextest.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[test-groups]
2+
database = { max-threads = 1 }
3+
4+
[profile.default]
5+
retries = 1
6+
7+
# sqlx has a problem with nextest, as it uses a process-local semaphore to have
8+
# tests use different databases. This doesn't work with nextest, as it has a
9+
# process-per-test model, which is why we need to make sure only one test uses
10+
# the database at a time.
11+
# See https://github.com/launchbadge/sqlx/pull/3334
12+
[[profile.default.overrides]]
13+
filter = 'package(mas-handlers) or package(mas-storage-pg)'
14+
test-group = 'database'

.github/workflows/ci.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ jobs:
292292

293293
strategy:
294294
matrix:
295-
partition: [1, 2]
295+
partition: [1, 2, 3]
296296

297297
services:
298298
postgres:
@@ -350,11 +350,9 @@ jobs:
350350
env:
351351
DATABASE_URL: postgresql://postgres:postgres@localhost/postgres
352352
run: |
353-
~/.cargo/bin/cargo-nextest nextest run --archive-file nextest-archive.tar.zst \
354-
--partition count:${{ matrix.partition }}/2 \
355-
--retries 1
356-
# --retries is a workaround for sqlx not playing nice with nextest
357-
# Waiting for https://github.com/launchbadge/sqlx/pull/3334
353+
~/.cargo/bin/cargo-nextest nextest run \
354+
--archive-file nextest-archive.tar.zst \
355+
--partition count:${{ matrix.partition }}/3
358356
359357
syn2mas:
360358
name: Check syn2mas

0 commit comments

Comments
 (0)