lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject [2/3] lucene-solr:master: SOLR-12801: Try to harden TestReplicatinHandler#doTestIndexFetchOnMasterRestart.
Date Mon, 10 Dec 2018 04:55:52 GMT
SOLR-12801: Try to harden TestReplicatinHandler#doTestIndexFetchOnMasterRestart.


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

Branch: refs/heads/master
Commit: 5405b2f1c3bfca7762b16fc07179f27543904be6
Parents: f47976a
Author: markrmiller <markrmiller@apache.org>
Authored: Sun Dec 9 22:18:37 2018 -0600
Committer: markrmiller <markrmiller@apache.org>
Committed: Sun Dec 9 22:55:25 2018 -0600

----------------------------------------------------------------------
 .../solr/handler/TestReplicationHandler.java    | 27 ++++++++++++++------
 1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5405b2f1/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
----------------------------------------------------------------------
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 f1a9a86..f2b0b39 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
@@ -647,14 +647,23 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
       String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult,
0, null);
       assertEquals(null, cmp);
 
-      int timesReplicated = Integer.parseInt(getSlaveDetails("timesIndexReplicated"));
-      String timesFailed = getSlaveDetails("timesFailed");
-      if (null == timesFailed) {
+      String timesReplicatedString = getSlaveDetails("timesIndexReplicated");
+      String timesFailed;
+      Integer previousTimesFailed = null;
+      if (timesReplicatedString == null) {
         timesFailed = "0";
+      } else {
+        int timesReplicated = Integer.parseInt(timesReplicatedString);
+        timesFailed = getSlaveDetails("timesFailed");
+        if (null == timesFailed) {
+          timesFailed = "0";
+        }
+
+        previousTimesFailed = Integer.parseInt(timesFailed);
+        // Sometimes replication will fail because master's core is still loading; make sure
there was one success
+        assertEquals(1, timesReplicated - previousTimesFailed);
+
       }
-      int previousTimesFailed = Integer.parseInt(timesFailed);
-      // Sometimes replication will fail because master's core is still loading; make sure
there was one success
-      assertEquals(1, timesReplicated - previousTimesFailed);
 
       masterJetty.stop();
 
@@ -672,7 +681,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
       assertEquals(nDocs, numFound(slaveQueryRsp));
 
       int failed = Integer.parseInt(getSlaveDetails("timesFailed"));
-      assertTrue(failed > previousTimesFailed);
+      if (previousTimesFailed != null) {
+        assertTrue(failed > previousTimesFailed);
+      }
       assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")) - failed);
     } finally {
       resetFactory();
@@ -684,7 +695,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
     params.set(CommonParams.QT, "/replication");
     params.set("command", "details");
     QueryResponse response = slaveClient.query(params);
-    System.out.println("SHALIN: " + response.getResponse());
+
     // details/slave/timesIndexReplicated
     NamedList<Object> details = (NamedList<Object>) response.getResponse().get("details");
     NamedList<Object> slave = (NamedList<Object>) details.get("slave");


Mime
View raw message