Files
minstrel/ci/db-test-packages.sh
T
bvandeusenandClaude Opus 5.5 7fe0c68899
release / go (push) Successful in 1m52s
release / web (push) Failing after 5s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m15s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Publish the release image to GHCR (dispatch only) (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 4m8s
release / android (push) Canceled after 4m33s
ci: the integration lane runs only packages with database tests, built in parallel first
The integration job ran `go test -p 1 -race ./...`: every package, one at
a time, including 18 with no database test whose unit tests the go lane
had already run. -p 1 also serialized compiling, about 50s before the
first test ran.

ci/db-test-packages.sh lists the packages whose tests reach Postgres
(through internal/dbtest or MINSTREL_TEST_DATABASE_URL); a package that
mentions neither cannot run a database test. The job builds those test
binaries with full parallelism (-run '^$'), then runs them serially as
before. make test-integration uses the same list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 10:19:56 -05:00

20 lines
764 B
Bash
Executable File

#!/bin/sh
#
# Prints the Go packages that hold database tests, one import path per line.
#
# A database test gets its Postgres from MINSTREL_TEST_DATABASE_URL, either
# through internal/dbtest or by reading the variable itself. A package whose
# tests mention neither cannot reach the database, so its tests are all unit
# tests: the `go` lane already runs them, and the `integration` lane skips the
# package instead of compiling and running it a second time, serially.
#
# Usage: go test -p 1 -race $(sh ci/db-test-packages.sh)
set -eu
go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}} {{.Dir}}{{end}}' ./... |
while read -r pkg dir; do
if grep -qs -e 'dbtest\.' -e 'MINSTREL_TEST_DATABASE_URL' "$dir"/*_test.go; then
echo "$pkg"
fi
done