Skip to content

Commit

Permalink
[DBCP-597] Validation query not timing out on connections managed by
Browse files Browse the repository at this point in the history
SharedPoolDataSource

Test edge case
  • Loading branch information
garydgregory committed Dec 15, 2024
1 parent 7659d9e commit ec41eed
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,12 @@ public void testDbcp597() throws SQLException {
// The tester statement throws a SQLTimeoutException when the timeout is > 0 and < 5.
sharedPoolDataSource.setValidationQueryTimeout(Duration.ofSeconds(1));
// The SQLTimeoutException is lost for now
final SQLException e = assertThrows(SQLException.class, sharedPoolDataSource::getConnection);
SQLException e = assertThrows(SQLException.class, sharedPoolDataSource::getConnection);
assertEquals(NoSuchElementException.class, e.getCause().getClass());
// timeout > 0 and < 1
sharedPoolDataSource.setValidationQueryTimeout(Duration.ofMillis(999));
// The SQLTimeoutException is lost for now
e = assertThrows(SQLException.class, sharedPoolDataSource::getConnection);
assertEquals(NoSuchElementException.class, e.getCause().getClass());
}
}
Expand Down

0 comments on commit ec41eed

Please sign in to comment.