SOLR-1469: fix race in TestReplicationHandler

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@819514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2009-09-28 12:44:15 +00:00
parent 194f0ec51d
commit 917d67e306
1 changed files with 8 additions and 7 deletions

View File

@ -397,14 +397,9 @@ public class TestReplicationHandler extends AbstractSolrTestCase {
public void testReplicateAfterWrite2Slave() throws Exception {
//add 500 docs to master
for (int i = 0; i < 500; i++)
for (int i = 0; i < 500; i++) {
index(masterClient, "id", i, "name", "name = " + i);
masterClient.commit();
NamedList masterQueryRsp = query("*:*", masterClient);
SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
assertEquals(500, masterQueryResult.getNumFound());
}
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=disableReplication";
URL url = new URL(masterUrl);
@ -415,6 +410,12 @@ public class TestReplicationHandler extends AbstractSolrTestCase {
//e.printStackTrace();
}
masterClient.commit();
NamedList masterQueryRsp = query("*:*", masterClient);
SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
assertEquals(500, masterQueryResult.getNumFound());
index(slaveClient, "id", 555, "name", "name = " + 555);
slaveClient.commit(true, true);