Commit c7f5f073 authored by Andy Wilkinson's avatar Andy Wilkinson

Stop reusing the Cluster when waiting for Cassandra to start

See gh-10516
parent 927003e0
...@@ -109,19 +109,20 @@ public class CassandraDataAutoConfigurationIntegrationTests { ...@@ -109,19 +109,20 @@ public class CassandraDataAutoConfigurationIntegrationTests {
@Override @Override
protected void waitUntilReady() { protected void waitUntilReady() {
super.waitUntilReady(); super.waitUntilReady();
Cluster cluster = Cluster.builder().addContactPoint("localhost").build();
try { try {
Unreliables.retryUntilTrue((int) this.startupTimeout.getSeconds(), Unreliables.retryUntilTrue((int) this.startupTimeout.getSeconds(),
TimeUnit.SECONDS, checkConnection(cluster)); TimeUnit.SECONDS, checkConnection());
} }
catch (TimeoutException e) { catch (TimeoutException ex) {
throw new IllegalStateException(); throw new IllegalStateException(ex);
} }
} }
private Callable<Boolean> checkConnection(Cluster cluster) { private Callable<Boolean> checkConnection() {
return () -> { return () -> {
try { try (Cluster cluster = Cluster.builder().addContactPoint("localhost")
.build()) {
cluster.connect(); cluster.connect();
return true; return true;
} }
...@@ -130,6 +131,7 @@ public class CassandraDataAutoConfigurationIntegrationTests { ...@@ -130,6 +131,7 @@ public class CassandraDataAutoConfigurationIntegrationTests {
} }
}; };
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment