psalagnac commented on code in PR #2737:
URL: https://github.com/apache/solr/pull/2737#discussion_r1829398709


##########
solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java:
##########
@@ -242,45 +240,15 @@ public static void waitForCollectionToDisappear(
     log.info("Collection has disappeared - collection:{}", collection);
   }
 
-  static void waitForNewLeader(
-      CloudSolrClient cloudClient, String shardName, Replica oldLeader, 
TimeOut timeOut)
+  static void waitForNewLeader(CloudSolrClient cloudClient, String shardName, 
Replica oldLeader)
       throws Exception {
-    log.info("Will wait for a node to become leader for {} secs", 
timeOut.timeLeft(SECONDS));
+    log.info("Will wait for a node to become leader for 15 secs");
     ZkStateReader zkStateReader = ZkStateReader.from(cloudClient);
-    zkStateReader.forceUpdateCollection(DEFAULT_COLLECTION);
-
-    for (; ; ) {
-      ClusterState clusterState = zkStateReader.getClusterState();
-      DocCollection coll = clusterState.getCollection("collection1");
-      Slice slice = coll.getSlice(shardName);
-      if (slice.getLeader() != null
-          && !slice.getLeader().equals(oldLeader)
-          && slice.getLeader().getState() == Replica.State.ACTIVE) {
-        if (log.isInfoEnabled()) {
-          log.info(
-              "Old leader {}, new leader {}. New leader got elected in {} ms",
-              oldLeader,
-              slice.getLeader(),
-              timeOut.timeElapsed(MILLISECONDS));
-        }
-        break;
-      }
-
-      if (timeOut.hasTimedOut()) {

Review Comment:
   Good catch, thanks. I replaced the exception by a call to `fail()` with 
similar message.
   I also removed the `InterruptedException`. This one is not supposed to 
happen, and that's better to not consider it in the test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to