//go:build red_gate package db import ( "context" "os" "testing" "time" ) // TestPool_Connects is an integration test that requires a live Postgres // reachable via DATABASE_URL. Skipped in unit-test runs without the env var // set. DSN value itself is never logged (info-disclosure T-01-06). func TestPool_Connects(t *testing.T) { dsn := os.Getenv("DATABASE_URL") if dsn == "" { t.Skip("DATABASE_URL not set — integration test skipped") } ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() pool, err := NewPool(ctx, dsn) if err != nil { t.Fatalf("NewPool: unexpected error: %v", err) } defer pool.Close() if err := pool.Ping(ctx); err != nil { t.Fatalf("pool.Ping: unexpected error: %v", err) } }