SOLR-11911: Move simulator reset to @Before method.

This commit is contained in:
Andrzej Bialecki 2018-06-06 11:06:50 +02:00
parent af7dfb182e
commit c1f42906ef
1 changed files with 27 additions and 29 deletions

View File

@ -80,7 +80,12 @@ public class SimSolrCloudTestCase extends SolrTestCaseJ4 {
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
if (cluster != null) { }
@Before
public void checkClusterConfiguration() throws Exception {
if (cluster == null)
throw new RuntimeException("SimCloudManager not configured - have you called configureCluster()?");
// clear any persisted configuration // clear any persisted configuration
cluster.getDistribStateManager().setData(SOLR_AUTOSCALING_CONF_PATH, Utils.toJSON(new ZkNodeProps()), -1); cluster.getDistribStateManager().setData(SOLR_AUTOSCALING_CONF_PATH, Utils.toJSON(new ZkNodeProps()), -1);
cluster.getDistribStateManager().setData(ZkStateReader.ROLES, Utils.toJSON(new HashMap<>()), -1); cluster.getDistribStateManager().setData(ZkStateReader.ROLES, Utils.toJSON(new HashMap<>()), -1);
@ -108,13 +113,6 @@ public class SimSolrCloudTestCase extends SolrTestCaseJ4 {
cluster.getTimeSource().sleep(5000); cluster.getTimeSource().sleep(5000);
cluster.simResetOpCounts(); cluster.simResetOpCounts();
} }
}
@Before
public void checkClusterConfiguration() {
if (cluster == null)
throw new RuntimeException("SimCloudManager not configured - have you called configureCluster()?");
}
protected void removeChildren(String path) throws Exception { protected void removeChildren(String path) throws Exception {
if (!cluster.getDistribStateManager().hasData(path)) { if (!cluster.getDistribStateManager().hasData(path)) {