Skip to content

Commit

Permalink
Make ClusterRule better behaved with existing cluster
Browse files Browse the repository at this point in the history
Previously, if a test failed in a class using ClusterRule as a
ClassRule (for example in ClusterTest), then subsequent tests
would fail since ClusterRule returned a cluster which had not
been repaired yet.
  • Loading branch information
spacecowboy committed Mar 30, 2016
1 parent becc97f commit fe92b0a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions enterprise/ha/src/test/java/org/neo4j/test/ha/ClusterRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,19 @@ private ClusterRule set( Builder builder )
*/
public ClusterManager.ManagedCluster startCluster() throws Exception
{
if ( cluster != null )
if ( cluster == null )
{
return cluster;
}

clusterManager = clusterManagerBuilder.withRootDirectory( storeDirectory ).build();
try
{
clusterManager.start();
}
catch ( Throwable throwable )
{
throw new RuntimeException( throwable );
clusterManager = clusterManagerBuilder.withRootDirectory( storeDirectory ).build();
try
{
clusterManager.start();
}
catch ( Throwable throwable )
{
throw new RuntimeException( throwable );
}
cluster = clusterManager.getCluster();
}
cluster = clusterManager.getCluster();
cluster.await( allSeesAllAsAvailable() );
return cluster;
}
Expand Down

0 comments on commit fe92b0a

Please sign in to comment.