Skip to content

Commit 7d26a0e

Browse files
authored
fix(pgtest): use t.Fatalf instead of t.Errorf for missing CL_DATABASE_URL (#21956)
pgtest.NewSqlxDB used t.Errorf (non-fatal) when CL_DATABASE_URL was missing, then returned nil. This caused SIGSEGV panics in downstream tests when they called methods on the nil *sqlx.DB. Changing to t.Fatalf stops test execution immediately, preventing the nil DB from propagating. Fixes: CORE-2371
1 parent ae52d5a commit 7d26a0e

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

core/internal/testutils/pgtest/pgtest.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ func NewSqlxDB(t testing.TB) *sqlx.DB {
1818
testutils.SkipShortDB(t)
1919
dbURL := string(env.DatabaseURL.Get())
2020
if dbURL == "" {
21-
t.Errorf("you must provide a CL_DATABASE_URL environment variable")
22-
return nil
21+
t.Fatalf("you must provide a CL_DATABASE_URL environment variable")
2322
}
2423
return sqltest.NewDB(t, dbURL)
2524
}

0 commit comments

Comments
 (0)