diff --git a/.forgejo/workflows/test-go.yml b/.forgejo/workflows/test-go.yml index 3906148b..60b0ce60 100644 --- a/.forgejo/workflows/test-go.yml +++ b/.forgejo/workflows/test-go.yml @@ -104,6 +104,9 @@ jobs: for i in $(seq 1 60); do (echo > "/dev/tcp/${PG_IP}/5432") 2>/dev/null && break; sleep 2; done # Apply embedded migrations to the fresh test DB, then run the - # full suite (no -short → integration tests execute). + # full suite (no -short → integration tests execute). -p 1: + # every integration package TRUNCATEs the one shared test DB; + # concurrent package binaries → TRUNCATE deadlocks. Serialize + # package execution (the documented local invocation too). MINSTREL_DATABASE_URL="$MINSTREL_TEST_DATABASE_URL" go run ./cmd/minstrel migrate - go test -race ./... + go test -p 1 -race ./... diff --git a/Makefile b/Makefile index 9799d2ff..fa1e2e04 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,9 @@ test-short: test-integration: docker compose up -d postgres -docker compose exec -T postgres createdb -U minstrel minstrel_test - MINSTREL_TEST_DATABASE_URL=postgres://minstrel:minstrel@localhost:5432/minstrel_test?sslmode=disable go test -race ./... + # -p 1: integration packages share one test DB and each TRUNCATEs it; + # concurrent package binaries deadlock on TRUNCATE. Serialize packages. + MINSTREL_TEST_DATABASE_URL=postgres://minstrel:minstrel@localhost:5432/minstrel_test?sslmode=disable go test -p 1 -race ./... lint: golangci-lint run ./...