You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2019/03/09 05:40:10 UTC

[lucene-solr] branch master updated: SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8c6e305  SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging
8c6e305 is described below

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

    SOLR-12732: TestLogWatcher failure on Jenkins. Added more logging
---
 .../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);
     }