You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mk...@apache.org on 2019/06/26 11:18:26 UTC

[lucene-solr] branch branch_8x updated: SOLR-13577: retrying TestReplicationHandler.doTestIndexFetchOnMasterRestart.

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/branch_8x by this push:
     new f9e8b8c  SOLR-13577: retrying TestReplicationHandler.doTestIndexFetchOnMasterRestart.
f9e8b8c is described below

commit f9e8b8cd0b78bb629c9b0225312cddf64fc73350
Author: Mikhail Khludnev <mk...@apache.org>
AuthorDate: Wed Jun 26 14:15:39 2019 +0300

    SOLR-13577: retrying TestReplicationHandler.doTestIndexFetchOnMasterRestart.
---
 .../apache/solr/handler/TestReplicationHandler.java | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
index cb57821..b188507 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
@@ -672,18 +672,27 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
       masterJetty.start();
 
       // poll interval on slave is 1 second, so we just sleep for a few seconds
-      Thread.sleep(2000);
+      for(int retries=0; ;retries++) { 
+        Thread.sleep(2000);
+        try {
+          int failed = Integer.parseInt(getSlaveDetails("timesFailed"));
+          if (previousTimesFailed != null) {
+            assertTrue(failed > previousTimesFailed);
+          }
+          assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")) - failed);
+          break;
+        } catch (NumberFormatException | AssertionError notYet) {
+          if (retries>9) {
+            throw notYet;
+          } 
+        }
+      }
 
       //get docs from slave and assert that they are still the same as before
       slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
       slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
       assertEquals(nDocs, numFound(slaveQueryRsp));
 
-      int failed = Integer.parseInt(getSlaveDetails("timesFailed"));
-      if (previousTimesFailed != null) {
-        assertTrue(failed > previousTimesFailed);
-      }
-      assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")) - failed);
     } finally {
       resetFactory();
     }