Browse Source

Upgrades MySql for testing to 8.0.24.

This version of the docker container doesn't allow to use `root` as the database user name.
We still have to connect as `root` so we can create alternative schemata.
pull/1032/head
Jens Schauder 5 years ago
parent
commit
91ca16ffef
No known key found for this signature in database
GPG Key ID: 45CC872F17423DBF
  1. 19
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/MySqlDataSourceConfiguration.java

19
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/MySqlDataSourceConfiguration.java

@ -52,9 +52,9 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
if (MYSQL_CONTAINER == null) { if (MYSQL_CONTAINER == null) {
MySQLContainer<?> container = new MySQLContainer<>() MySQLContainer<?> container = new MySQLContainer<>("mysql:8.0.24")
.withUsername("root") .withUsername("test")
.withPassword("") .withPassword("test")
.withConfigurationOverride(""); .withConfigurationOverride("");
container.start(); container.start();
@ -64,7 +64,7 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
MysqlDataSource dataSource = new MysqlDataSource(); MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUrl(MYSQL_CONTAINER.getJdbcUrl()); dataSource.setUrl(MYSQL_CONTAINER.getJdbcUrl());
dataSource.setUser(MYSQL_CONTAINER.getUsername()); dataSource.setUser("root");
dataSource.setPassword(MYSQL_CONTAINER.getPassword()); dataSource.setPassword(MYSQL_CONTAINER.getPassword());
dataSource.setDatabaseName(MYSQL_CONTAINER.getDatabaseName()); dataSource.setDatabaseName(MYSQL_CONTAINER.getDatabaseName());
@ -79,4 +79,15 @@ class MySqlDataSourceConfiguration extends DataSourceConfiguration {
new ByteArrayResource("DROP DATABASE test;CREATE DATABASE test;".getBytes())); new ByteArrayResource("DROP DATABASE test;CREATE DATABASE test;".getBytes()));
} }
} }
private DataSource createRootDataSource() {
MysqlDataSource dataSource = new MysqlDataSource();
dataSource.setUrl(MYSQL_CONTAINER.getJdbcUrl());
dataSource.setUser("root");
dataSource.setPassword(MYSQL_CONTAINER.getPassword());
dataSource.setDatabaseName(MYSQL_CONTAINER.getDatabaseName());
return dataSource;
}
} }

Loading…
Cancel
Save