retry to prevent false failures

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@979951 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2010-07-28 05:27:03 +00:00
parent 9cf23312ef
commit 41bb029ecf
1 changed files with 12 additions and 2 deletions

View File

@ -449,8 +449,18 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
slaveClient.commit(true, true);
//this doc is added to slave so it should show an item w/ that result
NamedList slaveQueryRsp = rQuery(1, "id:555", slaveClient);
SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
SolrDocumentList slaveQueryResult = null;
NamedList slaveQueryRsp;
// try a few times in case tests are running slow
for (int i = 0; i < 3; i++) {
slaveQueryRsp = rQuery(1, "id:555", slaveClient);
slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
if (slaveQueryResult.getNumFound() > 0) {
break;
}
Thread.sleep(100);
}
assertNotNull(slaveQueryResult);
assertEquals(1, slaveQueryResult.getNumFound());
masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=enableReplication";