Oracle との統合テストにtestcontainersライブラリを使用しようとしました。簡単なテストは次のとおりです。
public class SimpleTest {
@Rule
public OracleContainer oracle = new OracleContainer();
@Test
public void simpleTest() throws SQLException {
HikariDataSource ds = buildHikariDataSource();
Statement statement = ds.getConnection().createStatement();
statement.execute("SELECT 1 FROM dual");
ResultSet resultSet = statement.getResultSet();
resultSet.next();
int resultSetInt = resultSet.getInt(1);
assertEquals("A basic SELECT query succeeds", 1, resultSetInt);
}
private HikariDataSource buildHikariDataSource() {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setJdbcUrl(oracle.getJdbcUrl());
hikariConfig.setUsername(oracle.getUsername());
hikariConfig.setPassword(oracle.getPassword());
return new HikariDataSource(hikariConfig);
}
}
But it fails with TimeoutException:
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:256)
at org.testcontainers.containers.GenericContainer.lambda$start$0(GenericContainer.java:184)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
... 18 more
Caused by: org.rnorth.ducttape.TimeoutException: org.rnorth.ducttape.TimeoutException: java.util.concurrent.TimeoutException
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:53)
at org.testcontainers.containers.JdbcDatabaseContainer.waitUntilContainerStarted(JdbcDatabaseContainer.java:81)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:235)
... 20 more
私の Docker インストールは testcontainers-oracle-xe に適しており、OS は macOS Sierra 10.12.6 です。
この問題はどのように解決できますか?