mirror of https://github.com/apache/lucene.git
harden test some
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1159481 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a8949dce07
commit
f932976e99
|
@ -373,9 +373,9 @@ public class AutoCommitTest extends AbstractSolrTestCase {
|
||||||
|
|
||||||
// too low of a number can cause a slow host to commit before the test code checks that it
|
// too low of a number can cause a slow host to commit before the test code checks that it
|
||||||
// isn't there... causing a failure at "shouldn't find any"
|
// isn't there... causing a failure at "shouldn't find any"
|
||||||
softTracker.setTimeUpperBound(200);
|
softTracker.setTimeUpperBound(100);
|
||||||
softTracker.setDocsUpperBound(-1);
|
softTracker.setDocsUpperBound(-1);
|
||||||
hardTracker.setTimeUpperBound(1000);
|
hardTracker.setTimeUpperBound(500);
|
||||||
hardTracker.setDocsUpperBound(-1);
|
hardTracker.setDocsUpperBound(-1);
|
||||||
// updater.commitCallbacks.add(trigger);
|
// updater.commitCallbacks.add(trigger);
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ public class AutoCommitTest extends AbstractSolrTestCase {
|
||||||
trigger.reset();
|
trigger.reset();
|
||||||
handler.handleRequest( req, rsp );
|
handler.handleRequest( req, rsp );
|
||||||
|
|
||||||
// Check it it is in the index
|
// Check if it is in the index
|
||||||
assertQ("shouldn't find any", req("id:529") ,"//result[@numFound=0]" );
|
assertQ("shouldn't find any", req("id:529") ,"//result[@numFound=0]" );
|
||||||
|
|
||||||
// Wait longer than the autocommit time
|
// Wait longer than the autocommit time
|
||||||
|
@ -416,7 +416,8 @@ public class AutoCommitTest extends AbstractSolrTestCase {
|
||||||
req.setContentStreams( toContentStreams(
|
req.setContentStreams( toContentStreams(
|
||||||
adoc("id", "550", "field_t", "what's inside?", "subject", "info"), null ) );
|
adoc("id", "550", "field_t", "what's inside?", "subject", "info"), null ) );
|
||||||
handler.handleRequest( req, rsp );
|
handler.handleRequest( req, rsp );
|
||||||
assertEquals( 2, softTracker.getCommitCount() );
|
int totalCommits = softTracker.getCommitCount() + hardTracker.getCommitCount();
|
||||||
|
assertTrue("expected:>=2 but got " + totalCommits, totalCommits >= 2);
|
||||||
assertQ("deleted and time has passed", req("id:529") ,"//result[@numFound=0]" );
|
assertQ("deleted and time has passed", req("id:529") ,"//result[@numFound=0]" );
|
||||||
|
|
||||||
// now make the call 5 times really fast and make sure it
|
// now make the call 5 times really fast and make sure it
|
||||||
|
@ -440,7 +441,10 @@ public class AutoCommitTest extends AbstractSolrTestCase {
|
||||||
int softCommitCnt = softTracker.getCommitCount();
|
int softCommitCnt = softTracker.getCommitCount();
|
||||||
assertTrue("commit cnt:" + softCommitCnt, softCommitCnt == 2
|
assertTrue("commit cnt:" + softCommitCnt, softCommitCnt == 2
|
||||||
|| softCommitCnt == 3);
|
|| softCommitCnt == 3);
|
||||||
assertEquals(1, hardTracker.getCommitCount());
|
// depending on timing, you might see 1 or 2 hard commits
|
||||||
|
int hardCommitCnt = hardTracker.getCommitCount();
|
||||||
|
assertTrue("commit cnt:" + hardCommitCnt, hardCommitCnt == 1
|
||||||
|
|| hardCommitCnt == 2);
|
||||||
|
|
||||||
assertQ("now it should", req("id:500") ,"//result[@numFound=1]" );
|
assertQ("now it should", req("id:500") ,"//result[@numFound=1]" );
|
||||||
assertQ("but not this", req("id:531") ,"//result[@numFound=0]" );
|
assertQ("but not this", req("id:531") ,"//result[@numFound=0]" );
|
||||||
|
|
Loading…
Reference in New Issue