You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/09/07 07:49:11 UTC

[02/50] [abbrv] lucene-solr:jira/http2: SOLR-12728: RequestLoggingTest fails on occasion, not reproducible

SOLR-12728: RequestLoggingTest fails on occasion, not reproducible


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

Branch: refs/heads/jira/http2
Commit: 74b53b1a6756f106ec281dc6ef9bc52f7d989384
Parents: b4f9042
Author: Erick Erickson <Er...@gmail.com>
Authored: Mon Sep 3 10:19:33 2018 -0700
Committer: Erick Erickson <Er...@gmail.com>
Committed: Mon Sep 3 10:19:33 2018 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../apache/solr/handler/RequestLoggingTest.java | 21 ++++++++++++++++----
 .../org/apache/solr/logging/TestLogWatcher.java |  1 -
 3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74b53b1a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 74d73b6..1ba77ad 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -298,6 +298,8 @@ Bug Fixes
 * SOLR-12704: Guard AddSchemaFieldsUpdateProcessorFactory against null field names and field values.
   (Steve Rowe, Varun Thacker)
 
+* SOLR-12728: RequestLoggingTest fails on occasion, not reproducible (Erick Erickson)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74b53b1a/solr/core/src/test/org/apache/solr/handler/RequestLoggingTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/RequestLoggingTest.java b/solr/core/src/test/org/apache/solr/handler/RequestLoggingTest.java
index 0e8a7a9..ae08e9a 100644
--- a/solr/core/src/test/org/apache/solr/handler/RequestLoggingTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/RequestLoggingTest.java
@@ -82,10 +82,23 @@ public class RequestLoggingTest extends SolrTestCaseJ4 {
 
     try {
       assertQ(req("q", "*:*"));
-
-      String output = writer.toString();
-      Matcher matcher = Pattern.compile("DEBUG.*q=\\*:\\*.*").matcher(output);
-      assertTrue(matcher.find());
+      Matcher matcher = null;
+      boolean foundDebugMsg = false;
+      String output = "";
+      for (int msgIdx = 0; msgIdx < 100; ++msgIdx) {
+        output = writer.toString();
+        matcher = Pattern.compile("DEBUG.*q=\\*:\\*.*").matcher(output);
+        if (matcher.find()) {
+          foundDebugMsg = true;
+          break;
+        }
+        try {
+          Thread.sleep(10);
+        } catch (InterruptedException ie) {
+          ;
+        }
+      }
+      assertTrue("Should have found debug-level message. Found " + output, foundDebugMsg);
       final String group = matcher.group();
       final String msg = "Should not have post query information";
       assertFalse(msg, group.contains("hits"));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74b53b1a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
----------------------------------------------------------------------
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 9548363..658bc34 100644
--- a/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
+++ b/solr/core/src/test/org/apache/solr/logging/TestLogWatcher.java
@@ -53,7 +53,6 @@ public class TestLogWatcher extends SolrTestCaseJ4 {
 
       // Loop to give the logger time to process the async message and notify the new watcher.
       boolean foundMsg = false;
-      long last = -1;
       // In local testing this loop usually succeeds 1-2 tries.
       for (int msgIdx = 0; msgIdx < 100; ++msgIdx) {
         // Returns an empty (but non-null) list even if there are no messages yet.