Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor JDBC tests to avoid leaking DataSource & friends #5609

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jerrinot
Copy link
Contributor

performQuery() is leaking DataSources, Connections and Statements.
Chances are it's also leaking ResutSets, unless a caller closes it. This is an attempt to fix it.

I kept the leaky method as there can be users outside the main repo.

I stumbled upon this while working on #5606

@jerrinot jerrinot requested review from rnorth, bsideup, kiview and a team as code owners July 24, 2022 11:23
@jerrinot
Copy link
Contributor Author

btw- if you think this is overkill then feel free to close it. no hard feelings :)

Copy link
Member

@eddumelendez eddumelendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @jerrinot ! There is a couple of comments and we are ready to merge it.

Comment on lines +50 to +53
return getDataSource0(container);
}

private HikariDataSource getDataSource0(JdbcDatabaseContainer<?> container) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be kept. No need to create getDataSource0

* @return
* @throws SQLException
* @deprecated use {@link #assertQuery(JdbcDatabaseContainer, String, ResultSetConsumer)} instead.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*/
*/
@Deprecated

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.

None yet

2 participants