lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Solr JUnit test methods steping on eachother?
Date Thu, 29 Apr 2010 04:38:13 GMT
We not only want to reuse the core, we also want to reuse indexes. If the index is built in
beforeClass you can run all tests against it. If you need another index, write another test
class :-) This speeded up the tests in Lucene and Solr a lot. We now build indexes, that are
global in the beforeClass and destroy them in after class (and nulling out references to make
the GC happy). Tests like TestIndexWriter in Lucene, that *modify* indexes, do not build any
indexes in beforeClass, as index creation is part of the test.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Chris Hostetter [mailto:hossman_lucene@fucit.org]
> Sent: Thursday, April 29, 2010 2:10 AM
> To: Lucene Dev
> Subject: Re: Solr JUnit test methods steping on eachother?
> 
> 
> : 1) am i understanding "beforeClass" correctly?
> : 2) if so, then how is the current setup suppose to ensure that
> testAAA
> :     doesn't leave garbase arround that screws up testBBB ?
> 
> After skimming the JUnit annotation docs and experimenting, it looks
> like
> the SolrCore is definitely getting reused, and i was able to clean up
> the existing index by adding this to the test class...
> 
>   @After
>   public void after() throws Exception {
>     assertU(delQ("*:*"));
>     assertU(commit());
>   }
> 
> ...if reusing the SolreCore for each "test" method was deliberate, then
> shouldn't something like this be in the base class?
> 
> I still can't make sense of why this particular patch caused this
> particular failure -- none of hte docs i added had the field
> facet.prefix was being used on...
> 
> : 3) even if the anwer to #2 is "we don't ensure that" then how is my
> new test
> : method screwing things up in a way that the other exsiting test
> methods aren't
> : ?
> 
> 	...
> 
> : Patch....
> :
> : Index: src/test/org/apache/solr/request/SimpleFacetsTest.java
> : ===================================================================
> : --- src/test/org/apache/solr/request/SimpleFacetsTest.java
> 	(revision
> : 939066)
> : +++ src/test/org/apache/solr/request/SimpleFacetsTest.java
> 	(working copy)
> : @@ -390,6 +390,31 @@
> :     }
> :
> :     @Test
> : +  public void testDateFacetsWithIncludeOption() {
> : +    final String f = "bday";
> : +    final String pre =
> "//lst[@name='facet_dates']/lst[@name='"+f+"']";
> : +
> : +    // similar to testDateFacets
> : +    final String ooo = "00:00:00.000Z";
> : +
> : +    assertU(adoc("id", "0",  f, "1900-01-01T"+ooo));
> : +    assertU(commit());
> : +    assertU(adoc("id", "1",  f, "1976-07-01T"+ooo));
> : +    assertU(adoc("id", "2",  f, "1976-07-04T"+ooo));
> : +    assertU(adoc("id", "3",  f, "1976-07-05T"+ooo));
> : +    assertU(adoc("id", "4",  f, "1976-07-05T00:07:67.890Z"));
> : +    assertU(commit());
> : +    assertU(adoc("id", "5",  f, "1976-07-07T"+ooo));
> : +    assertU(adoc("id", "6",  f, "1976-07-13T"+ooo));
> : +    assertU(adoc("id", "7",  f, "1976-07-13T00:07:67.890Z"));
> : +    assertU(adoc("id", "8",  f, "1976-07-15T15:15:15.155Z"));
> : +    assertU(commit());
> : +    assertU(adoc("id", "9",  f, "2000-01-01T"+ooo));
> : +    assertU(commit());
> : +  }
> : +
> : +
> : +  @Test
> :     public void testFacetMultiValued() {
> :       doFacetPrefix("t_s", "facet.method","enum");
> :       doFacetPrefix("t_s", "facet.method", "enum",
> "facet.enum.cache.minDf",
> : "2");
> :
> :
> : ---------------------------------------------------------------------
> : To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> : For additional commands, e-mail: dev-help@lucene.apache.org
> :
> 
> 
> 
> -Hoss
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message