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:
Mark Robert Miller 2011-08-19 02:19:26 +00:00
parent a8949dce07
commit f932976e99
1 changed files with 9 additions and 5 deletions

View File

@ -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
// isn't there... causing a failure at "shouldn't find any"
softTracker.setTimeUpperBound(200);
softTracker.setTimeUpperBound(100);
softTracker.setDocsUpperBound(-1);
hardTracker.setTimeUpperBound(1000);
hardTracker.setTimeUpperBound(500);
hardTracker.setDocsUpperBound(-1);
// updater.commitCallbacks.add(trigger);
@ -392,7 +392,7 @@ public class AutoCommitTest extends AbstractSolrTestCase {
trigger.reset();
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]" );
// Wait longer than the autocommit time
@ -416,7 +416,8 @@ public class AutoCommitTest extends AbstractSolrTestCase {
req.setContentStreams( toContentStreams(
adoc("id", "550", "field_t", "what's inside?", "subject", "info"), null ) );
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]" );
// 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();
assertTrue("commit cnt:" + softCommitCnt, softCommitCnt == 2
|| 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("but not this", req("id:531") ,"//result[@numFound=0]" );