lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tflo...@apache.org
Subject svn commit: r1646918 - in /lucene/dev/trunk/solr/core/src: test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml test/org/apache/solr/search/TestIndexSearcher.java
Date Sat, 20 Dec 2014 06:18:38 GMT
Author: tflobbe
Date: Sat Dec 20 06:18:37 2014
New Revision: 1646918

URL: http://svn.apache.org/r1646918
Log:
SOLR-6864: Fix test race condition, make test wait for warming in TestIndexSearcher

Modified:
    lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java

Modified: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml?rev=1646918&r1=1646917&r2=1646918&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml
(original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-searcher-listeners1.xml
Sat Dec 20 06:18:37 2014
@@ -42,6 +42,8 @@
   <requestHandler name="standard" class="solr.StandardRequestHandler"/>
   
   <searchComponent name="mock" class="org.apache.solr.search.TestIndexSearcher$MockSearchComponent"/>
+  
+  <query><useColdSearcher>false</useColdSearcher></query>
 
 </config>
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java?rev=1646918&r1=1646917&r2=1646918&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java Sat
Dec 20 06:18:37 2014
@@ -19,7 +19,9 @@ package org.apache.solr.search;
 import java.io.IOException;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.lucene.index.IndexReader;
@@ -206,6 +208,7 @@ public class TestIndexSearcher extends S
     // reset counters
     MockSearcherListener.numberOfTimesCalled = new AtomicInteger();
     MockSearcherListener.numberOfTimesCalledFirstSearcher = new AtomicInteger();
+    MockSearcherListener.latch = new CountDownLatch(numTimesCalled);
     
     try {
       CoreDescriptor newCd = new CoreDescriptor(cores, "core1", cd.getInstanceDir(), "config",
"solrconfig-searcher-listeners1.xml");
@@ -216,6 +219,10 @@ public class TestIndexSearcher extends S
       assertNotNull(newCore.getSearchComponent("mock"));
       assertEquals(MockSearchComponent.class, newCore.getSearchComponent("mock").getClass());
       
+      if (numTimesCalled > 0) {
+        MockSearcherListener.latch.await(10, TimeUnit.SECONDS);
+      }
+      
       assertEquals(numTimesCalled, MockSearcherListener.numberOfTimesCalled.get());
       assertEquals(numTimesCalledFirstSearcher, MockSearcherListener.numberOfTimesCalledFirstSearcher.get());
       
@@ -274,6 +281,7 @@ public class TestIndexSearcher extends S
     
     static AtomicInteger numberOfTimesCalled;
     static AtomicInteger numberOfTimesCalledFirstSearcher;
+    static CountDownLatch latch;
 
     @Override
     public void init(NamedList args) {}
@@ -291,7 +299,7 @@ public class TestIndexSearcher extends S
       if (currentSearcher == null) {
         numberOfTimesCalledFirstSearcher.incrementAndGet();
       }
+      latch.countDown();
     }
-    
   }
 }



Mime
View raw message