Skip to content

Commit

Permalink
Don't ignore sql test query exception, add it as cause exception (#5484)
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly0karyakin committed Jun 13, 2022
1 parent 979d74a commit e7cdfa3
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -151,6 +151,7 @@ protected void waitUntilContainerStarted() {
// Repeatedly try and open a connection to the DB and execute a test query
long start = System.currentTimeMillis();

Exception lastConnectionException = null;
while (System.currentTimeMillis() < start + (1000 * startupTimeoutSeconds)) {
if (!isRunning()) {
Thread.sleep(100L);
Expand All @@ -165,6 +166,7 @@ protected void waitUntilContainerStarted() {
// we explicitly want this exception to fail fast without retries
throw e;
} catch (Exception e) {
lastConnectionException = e;
// ignore so that we can try again
logger().debug("Failure when trying test query", e);
Thread.sleep(100L);
Expand All @@ -176,7 +178,8 @@ protected void waitUntilContainerStarted() {
String.format(
"Container is started, but cannot be accessed by (JDBC URL: %s), please check container logs",
this.getJdbcUrl()
)
),
lastConnectionException
);
}

Expand Down

0 comments on commit e7cdfa3

Please sign in to comment.