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

Combine db tests #242

Closed
wants to merge 8 commits into from
Closed

Combine db tests #242

wants to merge 8 commits into from

Conversation

rnorth
Copy link
Member

@rnorth rnorth commented Nov 17, 2016

This change relocates all (non-proprietary) DB tests into a single module, to reduce the amount of boilerplate. It is envisaged that we can clean up these tests further going forward.

Additionally this PR includes changes to reduce the initial memory consumption of MySQL and MariaDB containers for reliability reasons.

Adopt MySQL and MariaDB default configuration with lighter resource requirements
public static Iterable<Object[]> data() {
return asList(
new Object[][]{
{"jdbc:tc:mysql:5.5.43://hostname/databasename", false, false, false},
Copy link
Member

Choose a reason for hiding this comment

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

awesome!

});
}

@Parameterized.Parameter(0)
Copy link
Member

Choose a reason for hiding this comment

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

maybe static import Parameter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely - will do.

new QueryRunner(dataSource).query("SELECT foo FROM bar WHERE foo LIKE '%world'", (ResultSetHandler<Object>) rs -> {
rs.next();
String resultSetString = rs.getString(1);
assertEquals("A basic SELECT query succeeds where the schema has been applied from a script", "hello world", resultSetString);
Copy link
Member

Choose a reason for hiding this comment

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

I'm just wondering what if ResultSetHandler will not be called.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well spotted - will address that!

assertEquals("A basic SELECT query succeeds where the schema has been applied from a script", "hello world", resultSetString);
return true;
});
dataSource.close();
Copy link
Member

Choose a reason for hiding this comment

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

HikariDataSource is AutoClosable, you can use try-with-resources

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do


<dependency>
<groupId>com.googlecode.junit-toolbox</groupId>
<artifactId>junit-toolbox</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

is it used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will remove

@rnorth
Copy link
Member Author

rnorth commented Nov 19, 2016

As this PR is completely included in #243 but doesn't include some bugfixes that are in the other PR, I'm going to close this one. Seems more straightforward that way.

@rnorth rnorth closed this Nov 19, 2016
@rnorth rnorth deleted the combine-db-tests branch November 19, 2016 20:20
rnorth added a commit that referenced this pull request Nov 19, 2016
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