lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From is...@apache.org
Subject [lucene-solr] branch branch_8_1 updated: SOLR-13410: Making the test more resilient
Date Mon, 06 May 2019 19:28:26 GMT
This is an automated email from the ASF dual-hosted git repository.

ishan pushed a commit to branch branch_8_1
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8_1 by this push:
     new 4788622  SOLR-13410: Making the test more resilient
4788622 is described below

commit 47886225187c0442e3d6bb93475eafacfccab6ff
Author: Ishan Chattopadhyaya <ishan@apache.org>
AuthorDate: Tue May 7 00:58:08 2019 +0530

    SOLR-13410: Making the test more resilient
---
 .../org/apache/solr/cloud/OverseerRolesTest.java   | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
index fde337e..bcfaeda 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
@@ -32,7 +32,8 @@ import org.apache.solr.common.util.TimeSource;
 import org.apache.solr.common.util.Utils;
 import org.apache.solr.util.TimeOut;
 import org.apache.zookeeper.KeeperException;
-import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,13 +45,17 @@ public class OverseerRolesTest extends SolrCloudTestCase {
 
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  @BeforeClass
-  public static void setupCluster() throws Exception {
-    configureCluster(6)
+  @Before
+  public void setupCluster() throws Exception {
+    configureCluster(4)
         .addConfig("conf", configset("cloud-minimal"))
         .configure();
   }
 
+  @After
+  public void tearDownCluster() throws Exception {
+    shutdownCluster();
+  }
   
   private void waitForNewOverseer(int seconds, Predicate<String> state, boolean failOnIntermediateTransition)
throws Exception {
     TimeOut timeout = new TimeOut(seconds, TimeUnit.SECONDS, TimeSource.NANO_TIME);
@@ -173,20 +178,24 @@ public class OverseerRolesTest extends SolrCloudTestCase {
       CollectionAdminRequest.removeRole(node, "overseer").process(cluster.getSolrClient());
     }
     String overseer1 = OverseerCollectionConfigSetProcessor.getLeaderNode(zkClient());
+    int counter = 0;
+    while (overseer1 == null && counter < 10) {
+      overseer1 = OverseerCollectionConfigSetProcessor.getLeaderNode(zkClient());
+      Thread.sleep(1000);
+    }
 
     // Setting overseer role to the current overseer
     CollectionAdminRequest.addRole(overseer1, "overseer").process(cluster.getSolrClient());
     waitForNewOverseer(15, overseer1, false);
+    JettySolrRunner leaderJetty = getOverseerJetty();
 
     List<String> nodes = OverseerCollectionConfigSetProcessor.getSortedOverseerNodeNames(zkClient());
     nodes.remove(overseer1); // remove the designated overseer
 
-    JettySolrRunner leaderJetty = getOverseerJetty();
     logOverseerState();
     // kill the current overseer, and check that the next node in the election queue assumes
leadership
     leaderJetty.stop();
     log.info("Killing designated overseer: "+overseer1);
-    waitForNewOverseer(10, nodes.get(0), false);
 
     // after 5 seconds, bring back dead designated overseer and assert that it assumes leadership
"right away",
     // i.e. without any other node assuming leadership before this node becomes leader.
@@ -197,3 +206,4 @@ public class OverseerRolesTest extends SolrCloudTestCase {
     waitForNewOverseer(15, overseer1, true); // assert that there is just a single leadership
transition
   }
 }
+


Mime
View raw message