Elffuss BraidHub

kikocis/java-driver public

Extend timeout when dropping keyspace in CCMBridge to 60 seconds.
Changeset04dcb6147d7c0798480c9ac8a46d77d9530cba8e4de44f8003a3bdf9714d089f
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-26 11:09 -05:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-26 16:33 -05:00
Parentsc7bbffe1167f

Browse the files at this changeset

1 file changed

modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +18 −4
@@ -504,7 +504,13 @@
504504
505505 @AfterClass(groups = { "short", "long" })
506506 public void afterClass() {
507- clearSimpleKeyspace();
507+ try {
508+ clearSimpleKeyspace();
509+ } finally {
510+ if(cluster != null) {
511+ cluster.close();
512+ }
513+ }
508514 }
509515
510516 private void maybeInitCluster(){
@@ -568,9 +574,17 @@
568574 }
569575
570576 private void clearSimpleKeyspace() {
571- session.execute("DROP KEYSPACE " + keyspace);
572- if (cluster != null) {
573- cluster.close();
577+ if(keyspace != null) {
578+ // Temporarily extend read timeout to 1 minute to accommodate keyspaces with many tables.
579+ // This should be more than enough although some tests create many tables, so dropping a keyspace
580+ // could take as long as 12 seconds on restricted hardware.
581+ int currentTimeout = cluster.getConfiguration().getSocketOptions().getReadTimeoutMillis();
582+ cluster.getConfiguration().getSocketOptions().setReadTimeoutMillis(60000);
583+ try {
584+ session.execute("DROP KEYSPACE " + keyspace);
585+ } finally {
586+ cluster.getConfiguration().getSocketOptions().setReadTimeoutMillis(currentTimeout);
587+ }
574588 }
575589 }
576590