Skip to content

Commit

Permalink
Fix overriden CMD in MariaDB container (#767) (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldailly authored and kiview committed Jul 3, 2018
1 parent f113979 commit 577b509
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Linux/Mac: Added support for docker credential helpers so that images may be pulled from private registries. See [\#729](https://github.com/testcontainers/testcontainers-java/issues/729), [\#647](https://github.com/testcontainers/testcontainers-java/issues/647) and [\#567](https://github.com/testcontainers/testcontainers-java/issues/567).
- Ensure that the `COMPOSE_FILE` environment variable is populated with all relevant compose file names when running docker-compose in local mode [\#755](https://github.com/testcontainers/testcontainers-java/issues/755).
- Fixed issue whereby specified command in MariaDB image was not being applied. ([\#534](https://github.com/testcontainers/testcontainers-java/issues/534))

### Changed
- Update Apache Pulsar module to 2.0.1 [\#760](https://github.com/testcontainers/testcontainers-java/issues/760).
Expand Down
Expand Up @@ -56,7 +56,7 @@ public void testSpecificVersion() throws SQLException {
public void testMariaDBWithCustomIniFile() throws SQLException {
assumeFalse(SystemUtils.IS_OS_WINDOWS);
MariaDBContainer mariadbCustomConfig = new MariaDBContainer("mariadb:10.1.16")
.withConfigurationOverride("somepath/mariadb_conf_override");
.withConfigurationOverride("somepath/mariadb_conf_override");
mariadbCustomConfig.start();

try {
Expand All @@ -69,6 +69,23 @@ public void testMariaDBWithCustomIniFile() throws SQLException {
}
}

@Test
public void testMariaDBWithCommandOverride() throws SQLException {

MariaDBContainer mariadbCustomConfig = (MariaDBContainer) new MariaDBContainer("mariadb:10.1.16")
.withCommand("mysqld --auto_increment_increment=10");
mariadbCustomConfig.start();

try {
ResultSet resultSet = performQuery(mariadbCustomConfig, "show variables like 'auto_increment_increment'");
String result = resultSet.getString("Value");

assertEquals("Auto increment increment should be overriden by command line", "10", result);
} finally {
mariadbCustomConfig.stop();
}
}

@NonNull
protected ResultSet performQuery(MariaDBContainer containerRule, String sql) throws SQLException {
HikariConfig hikariConfig = new HikariConfig();
Expand Down
Expand Up @@ -39,7 +39,6 @@ protected void configure() {
addEnv("MYSQL_USER", MARIADB_USER);
addEnv("MYSQL_PASSWORD", MARIADB_PASSWORD);
addEnv("MYSQL_ROOT_PASSWORD", MARIADB_PASSWORD);
setCommand("mysqld");
setStartupAttempts(3);
}

Expand Down

0 comments on commit 577b509

Please sign in to comment.