Skip to content

Commit

Permalink
Don't run tests with database in parallel.
Browse files Browse the repository at this point in the history
By default, multiple packages may be tested in parallel in different processes.
Passing -p 1 reduces this to one process to prevent test cases in different
packages from accessing the same database. Note that t.Parallel() only affects
parallelism within one process, i.e.  within the tests of one package.

Co-authored-by: Alvar Penning <[email protected]>
  • Loading branch information
julianbrost and oxzi committed Jul 17, 2024
1 parent 51c815e commit 8a824f1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/tests_with_database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ jobs:

- name: Run tests
timeout-minutes: 10
run: go test -v -timeout 5m ./...
# By default, multiple packages may be tested in parallel in different
# processes. Passing -p 1 reduces this to one process to prevent test
# cases in different packages from accessing the same database. Note
# that t.Parallel() only affects parallelism within one process, i.e.
# within the tests of one package.
run: go test -v -timeout 5m -p 1 ./...

postgresql:
name: PostgreSQL ${{ matrix.version }}
Expand Down Expand Up @@ -125,4 +130,9 @@ jobs:

- name: Run tests
timeout-minutes: 10
run: go test -v -timeout 5m ./...
# By default, multiple packages may be tested in parallel in different
# processes. Passing -p 1 reduces this to one process to prevent test
# cases in different packages from accessing the same database. Note
# that t.Parallel() only affects parallelism within one process, i.e.
# within the tests of one package.
run: go test -v -timeout 5m -p 1 ./...

0 comments on commit 8a824f1

Please sign in to comment.