lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [1/2] lucene-solr:branch_7x: SOLR-11911: Move simulator reset to @Before method.
Date Wed, 06 Jun 2018 09:07:44 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 0cfa798f8 -> bc9cd8086


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/bc9cd808
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bc9cd808
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bc9cd808

Branch: refs/heads/branch_7x
Commit: bc9cd8086631bae62b87b9b0859500a7968ca3da
Parents: 0307922
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:07:38 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/bc9cd808/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