lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [lucene-solr] branch branch_8x updated: SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging
Date Sat, 09 Mar 2019 05:43:27 GMT
This is an automated email from the ASF dual-hosted git repository.

erick 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 83ab355  SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging
83ab355 is described below

commit 83ab355772d46b755cab52e73051f395f938fd72
Author: Erick Erickson <Erick.Erickson@gmail.com>
AuthorDate: Fri Mar 8 21:40:06 2019 -0800

    SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging
    
    (cherry picked from commit 8c6e30536562413639eaf8bab1087da700733b33)
---
 .../org/apache/solr/logging/TestLogWatcher.java     | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java b/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
index d036737..cd3b180 100644
--- a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
+++ b/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
@@ -45,13 +45,26 @@ public class TestLogWatcher extends SolrTestCaseJ4 {
     LogWatcher watcher = null;
     int lim = random().nextInt(3) + 2;
     for (int idx = 0; idx < lim; ++idx) {
-      String msg = "This is a test message: " + idx;
+
       watcher = LogWatcher.newRegisteredLogWatcher(config, null);
 
       // First ensure there's nothing in the new watcher.
-      assertEquals(-1, watcher.getLastEvent());
+      long lastEvent = watcher.getLastEvent();
+      if (lastEvent != -1L) { // Dump some information to try to understand failure.
+        AtomicBoolean ab = new AtomicBoolean();
+        SolrDocumentList events = watcher.getHistory(-1, ab);
+
+        System.out.println("Found value is: " + ab.toString());
+
+        System.out.println("Dumping all events in this watcher:");
+        for (SolrDocument doc : events) {
+          System.out.println("   Event:'" + doc.toString() +"'");
+        }
+        fail("lastEvent was not -1, was: '" + lastEvent + "'");
+      }
 
       // Now log a message and ensure that the new watcher sees it.
+      String msg = "This is a test message: " + idx;
       log.warn(msg);
 
       // Loop to give the logger time to process the async message and notify the new watcher.
@@ -60,7 +73,7 @@ public class TestLogWatcher extends SolrTestCaseJ4 {
       // In local testing this loop usually succeeds 1-2 tries.
       do {
         // Returns an empty (but non-null) list even if there are no messages yet.
-        SolrDocumentList events = watcher.getHistory(-1, new AtomicBoolean());
+        SolrDocumentList events = watcher.getHistory(-1, null);
         for (SolrDocument doc : events) {
           if (doc.get("message").equals(msg)) {
             foundMsg = true;
@@ -68,7 +81,7 @@ public class TestLogWatcher extends SolrTestCaseJ4 {
           }
         }
         Thread.sleep(10);
-      } while (timeOut.hasTimedOut() == false);
+      } while (foundMsg == false && timeOut.hasTimedOut() == false);
 
       assertTrue("Should have found message " + msg + " in loop: " + idx, foundMsg);
     }


Mime
View raw message