Skip to content

Make dbcp2 testOnBorrow configurable#313

Merged
suddendust merged 2 commits into
mainfrom
dbcp2_testOnBorrowConfig
Jun 29, 2026
Merged

Make dbcp2 testOnBorrow configurable#313
suddendust merged 2 commits into
mainfrom
dbcp2_testOnBorrowConfig

Conversation

@suddendust

@suddendust suddendust commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds configuration support for testOnBorrow in the Postgres connection pool with a default value of true. This ensures connections are validated before being borrowed from the pool, preventing stale or broken connections from being handed to the application.

Before this, default is false

  /**
     * The default value for the {@code testOnBorrow} configuration attribute.
     * @see GenericObjectPool#getTestOnBorrow()
     * @see GenericKeyedObjectPool#getTestOnBorrow()
     */
    public static final boolean DEFAULT_TEST_ON_BORROW = false;

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.44%. Comparing base (35f7620) to head (25b3f59).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #313   +/-   ##
=========================================
  Coverage     81.43%   81.44%           
- Complexity     1549     1550    +1     
=========================================
  Files           242      242           
  Lines          7514     7517    +3     
  Branches        726      726           
=========================================
+ Hits           6119     6122    +3     
  Misses          943      943           
  Partials        452      452           
Flag Coverage Δ
integration 81.44% <100.00%> (+<0.01%) ⬆️
unit 55.52% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

Test Results

  124 files  ±0    124 suites  ±0   38s ⏱️ -1s
  840 tests ±0    839 ✅ ±0  1 💤 ±0  0 ❌ ±0 
1 176 runs  ±0  1 175 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 25b3f59. ± Comparison against base commit 35f7620.

♻️ This comment has been updated with latest results.

@puneet-traceable

Copy link
Copy Markdown

Curious: How is the borrow tested? Some ping like query?

@suddendust suddendust merged commit 37632d1 into main Jun 29, 2026
7 checks passed
@suddendust suddendust deleted the dbcp2_testOnBorrowConfig branch June 29, 2026 06:23
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.

2 participants