#!/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