Skip to content

fix(pgtest): use t.Fatalf instead of t.Errorf for missing CL_DATABASE_URL#21956

Open
Fletch153 wants to merge 1 commit intodevelopfrom
fix/CORE-2371-pgtest-nil-db-panic
Open

fix(pgtest): use t.Fatalf instead of t.Errorf for missing CL_DATABASE_URL#21956
Fletch153 wants to merge 1 commit intodevelopfrom
fix/CORE-2371-pgtest-nil-db-panic

Conversation

@Fletch153
Copy link
Copy Markdown
Collaborator

Summary

  • Changes t.Errorft.Fatalf in pgtest.NewSqlxDB when CL_DATABASE_URL is missing
  • Prevents SIGSEGV panics from nil *sqlx.DB propagating to downstream tests

Root Cause

t.Errorf is non-fatal, so the function returned nil. Any test calling pgtest.NewSqlxDB without a database URL would get a nil DB and panic on the first query.

Test plan

  • CI passes
  • Tests that call pgtest.NewSqlxDB without DB fail cleanly instead of panicking

Fixes: CORE-2371

…_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
@Fletch153 Fletch153 requested review from a team as code owners April 10, 2026 13:27
@github-actions
Copy link
Copy Markdown
Contributor

👋 Fletch153, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@trunk-io
Copy link
Copy Markdown

trunk-io bot commented Apr 10, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestORM The test failed without a specific error message, likely due to an issue in the test setup or environment. Logs ↗︎

View Full Report ↗︎Docs

@Fletch153
Copy link
Copy Markdown
Collaborator Author

/rerun

@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant