chore: stop running postgres-only tests if DB is not set (#18784)

Fixes https://github.com/coder/internal/issues/695

PostgreSQL tests are getting run in a non-postgres CI job because the tests don't get skipped if the `DB=` env is unset. This PR adds a skip for them.

They are flaking in the `test-go-race` CI job. They run fine in the `test-go-race-pg` job, which pre-creates the postgres server, so the flakiness is almost certainly related to spinning up the database server.
This commit is contained in:
Spike Curtis
2025-07-08 15:56:22 +04:00
committed by GitHub
parent 211393a69c
commit bf0271fd65
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -85,6 +85,10 @@ func TestNestedInTx(t *testing.T) {
func testSQLDB(t testing.TB) *sql.DB {
t.Helper()
if !dbtestutil.WillUsePostgres() {
t.Skip("this test requires postgres")
}
connection, err := dbtestutil.Open(t)
require.NoError(t, err)