From c230f43d2a1c562c7d2c2e17df48cf608c6106f2 Mon Sep 17 00:00:00 2001 From: Michael Fletcher Date: Fri, 10 Apr 2026 11:40:03 +0100 Subject: [PATCH] fix(pgtest): use t.Fatalf instead of t.Errorf for missing CL_DATABASE_URL 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 --- core/internal/testutils/pgtest/pgtest.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/internal/testutils/pgtest/pgtest.go b/core/internal/testutils/pgtest/pgtest.go index 765c03e1d70..228990c7ba3 100644 --- a/core/internal/testutils/pgtest/pgtest.go +++ b/core/internal/testutils/pgtest/pgtest.go @@ -18,8 +18,7 @@ func NewSqlxDB(t testing.TB) *sqlx.DB { testutils.SkipShortDB(t) dbURL := string(env.DatabaseURL.Get()) if dbURL == "" { - t.Errorf("you must provide a CL_DATABASE_URL environment variable") - return nil + t.Fatalf("you must provide a CL_DATABASE_URL environment variable") } return sqltest.NewDB(t, dbURL) }