Skip to content

Commit

Permalink
Log cause of startup failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Nov 7, 2023
1 parent d1e18b4 commit 422790f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/com/exasol/containers/ExasolContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class ExasolContainer<T extends ExasolContainer<T>> extends JdbcDatabaseC
private boolean reused = false;
private final ExasolDockerImageReference dockerImageReference;
private boolean portAutodetectFailed = false;
private int connectionWaitTimeoutSeconds = 250;
private int connectionWaitTimeoutSeconds = 600;
private ExasolDriverManager driverManager = null;
private final ContainerStatusCache statusCache = new ContainerStatusCache(CACHE_DIRECTORY);
private ContainerStatus status = null;
Expand Down Expand Up @@ -350,7 +350,7 @@ public Connection createConnection() throws SQLException {
// [impl->dsn~exasol-container-ready-criteria~3]
@Override
protected String getTestQueryString() {
return "SELECT 1 FROM DUAL";
return "SELECT 1";
}

@Override
Expand Down Expand Up @@ -710,7 +710,7 @@ private void waitUntilStatementCanBeExecuted() {
}
}
final Duration timeoutAfter = Duration.between(before, Instant.now());
throw new ContainerLaunchException(ExaError.messageBuilder("F-ETC-5")
final ContainerLaunchException exception = new ContainerLaunchException(ExaError.messageBuilder("F-ETC-5")
.message("Exasol container start-up timed out trying connection to {{url}} using query {{query}}"
+ " after {{after}} seconds. Last connection exception was: {{exception}}")
.parameter("url", getJdbcUrl(), "JDBC URL of the connection to the Exasol Testcontainer")
Expand All @@ -720,6 +720,8 @@ private void waitUntilStatementCanBeExecuted() {
(this.lastConnectionException == null) ? "none" : this.lastConnectionException.getMessage(),
"exception thrown on last connection attempt")
.toString(), this.lastConnectionException);
LOGGER.error(exception.getMessage(), this.lastConnectionException);
throw exception;
}

private void sleepBeforeNextConnectionAttempt() {
Expand Down

0 comments on commit 422790f

Please sign in to comment.