lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject lucene-solr:master: SOLR-11911: Move simulator reset to @Before method.
Date Wed, 06 Jun 2018 09:48:48 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master af7dfb182 -> c1f42906e


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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c1f42906
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c1f42906
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c1f42906

Branch: refs/heads/master
Commit: c1f42906ef1e0929f3887736dd9bb5bd0f9975c8
Parents: af7dfb1
Author: Andrzej Bialecki <ab@apache.org>
Authored: Wed Jun 6 11:06:50 2018 +0200
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Wed Jun 6 11:48:42 2018 +0200

----------------------------------------------------------------------
 .../autoscaling/sim/SimSolrCloudTestCase.java   | 56 ++++++++++----------
 1 file changed, 27 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1f42906/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java
b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java
index e83f72f..270e7e7 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java
@@ -80,40 +80,38 @@ public class SimSolrCloudTestCase extends SolrTestCaseJ4 {
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    if (cluster != null) {
-      // clear any persisted configuration
-      cluster.getDistribStateManager().setData(SOLR_AUTOSCALING_CONF_PATH, Utils.toJSON(new
ZkNodeProps()), -1);
-      cluster.getDistribStateManager().setData(ZkStateReader.ROLES, Utils.toJSON(new HashMap<>()),
-1);
-      cluster.getSimClusterStateProvider().simDeleteAllCollections();
-      cluster.simClearSystemCollection();
-      cluster.getSimNodeStateProvider().simRemoveDeadNodes();
-      cluster.getSimClusterStateProvider().simRemoveDeadNodes();
-      // restore the expected number of nodes
-      int currentSize = cluster.getLiveNodesSet().size();
-      if (currentSize < clusterNodeCount) {
-        int addCnt = clusterNodeCount - currentSize;
-        while (addCnt-- > 0) {
-          cluster.simAddNode();
-        }
-      } else if (currentSize > clusterNodeCount) {
-        cluster.simRemoveRandomNodes(currentSize - clusterNodeCount, true, random());
-      }
-      // clean any persisted trigger state or events
-      removeChildren(ZkStateReader.SOLR_AUTOSCALING_EVENTS_PATH);
-      removeChildren(ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH);
-      removeChildren(ZkStateReader.SOLR_AUTOSCALING_NODE_LOST_PATH);
-      removeChildren(ZkStateReader.SOLR_AUTOSCALING_NODE_ADDED_PATH);
-      cluster.getSimClusterStateProvider().simResetLeaderThrottles();
-      cluster.simRestartOverseer(null);
-      cluster.getTimeSource().sleep(5000);
-      cluster.simResetOpCounts();
-    }
   }
 
   @Before
-  public void checkClusterConfiguration() {
+  public void checkClusterConfiguration() throws Exception {
     if (cluster == null)
       throw new RuntimeException("SimCloudManager not configured - have you called configureCluster()?");
+    // clear any persisted configuration
+    cluster.getDistribStateManager().setData(SOLR_AUTOSCALING_CONF_PATH, Utils.toJSON(new
ZkNodeProps()), -1);
+    cluster.getDistribStateManager().setData(ZkStateReader.ROLES, Utils.toJSON(new HashMap<>()),
-1);
+    cluster.getSimClusterStateProvider().simDeleteAllCollections();
+    cluster.simClearSystemCollection();
+    cluster.getSimNodeStateProvider().simRemoveDeadNodes();
+    cluster.getSimClusterStateProvider().simRemoveDeadNodes();
+    // restore the expected number of nodes
+    int currentSize = cluster.getLiveNodesSet().size();
+    if (currentSize < clusterNodeCount) {
+      int addCnt = clusterNodeCount - currentSize;
+      while (addCnt-- > 0) {
+        cluster.simAddNode();
+      }
+    } else if (currentSize > clusterNodeCount) {
+      cluster.simRemoveRandomNodes(currentSize - clusterNodeCount, true, random());
+    }
+    // clean any persisted trigger state or events
+    removeChildren(ZkStateReader.SOLR_AUTOSCALING_EVENTS_PATH);
+    removeChildren(ZkStateReader.SOLR_AUTOSCALING_TRIGGER_STATE_PATH);
+    removeChildren(ZkStateReader.SOLR_AUTOSCALING_NODE_LOST_PATH);
+    removeChildren(ZkStateReader.SOLR_AUTOSCALING_NODE_ADDED_PATH);
+    cluster.getSimClusterStateProvider().simResetLeaderThrottles();
+    cluster.simRestartOverseer(null);
+    cluster.getTimeSource().sleep(5000);
+    cluster.simResetOpCounts();
   }
 
   protected void removeChildren(String path) throws Exception {


Mime
View raw message