kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 04dcb6147d7c0798480c9ac8a46d77d9530cba8e4de44f8003a3bdf9714d089f |
|---|---|
| Author | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-26 11:09 -05:00 |
| Committer | Andrew Tolbert <andrew.tolbert@datastax.com> · 2015-06-26 16:33 -05:00 |
| Parents | c7bbffe1167f |
1 file changed
modified driver-core/src/test/java/com/datastax/driver/core/CCMBridge.java +18 −4
| @@ -504,7 +504,13 @@ | ||
| 504 | 504 | |
| 505 | 505 | @AfterClass(groups = { "short", "long" }) |
| 506 | 506 | public void afterClass() { |
| 507 | - clearSimpleKeyspace(); | |
| 507 | + try { | |
| 508 | + clearSimpleKeyspace(); | |
| 509 | + } finally { | |
| 510 | + if(cluster != null) { | |
| 511 | + cluster.close(); | |
| 512 | + } | |
| 513 | + } | |
| 508 | 514 | } |
| 509 | 515 | |
| 510 | 516 | private void maybeInitCluster(){ |
| @@ -568,9 +574,17 @@ | ||
| 568 | 574 | } |
| 569 | 575 | |
| 570 | 576 | 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 | + } | |
| 574 | 588 | } |
| 575 | 589 | } |
| 576 | 590 |