SOLR-7774: revise BasicDistributedZkTest.test logic w.r.t. 'commitWithin did not work on some nodes'

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1718364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-12-07 14:08:10 +00:00
parent 35758f62c8
commit f81a8348ab
2 changed files with 18 additions and 7 deletions

View File

@ -252,6 +252,9 @@ Other Changes
* SOLR-8381: Cleanup data_driven managed-schema and solrconfig.xml files. Commented out copyFields are removed
and solrconfig.xml doesn't refer to field which are not defined. (Varun Thacker)
* SOLR-7774: revise BasicDistributedZkTest.test logic w.r.t. 'commitWithin did not work on some nodes'
(Christine Poerschke)
================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -64,6 +64,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -322,21 +323,28 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
// try commitWithin
long before = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
for (SolrClient client : clients) {
assertEquals("unexpected pre-commitWithin document count on node: " + ((HttpSolrClient)client).getBaseURL(), before, client.query(new SolrQuery("*:*")).getResults().getNumFound());
}
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("commitWithin", 10);
add(cloudClient, params, getDoc("id", 300));
final List<SolrClient> clientsToCheck = new ArrayList<>(clients);
TimeOut timeout = new TimeOut(45, TimeUnit.SECONDS);
while (cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound() != before + 1) {
if (timeout.hasTimedOut()) {
fail("commitWithin did not work");
do {
final Iterator<SolrClient> it = clientsToCheck.iterator();
while (it.hasNext()) {
final SolrClient sc = it.next();
if ((before + 1) == sc.query(new SolrQuery("*:*")).getResults().getNumFound()) {
it.remove();
}
}
Thread.sleep(100);
}
} while (!clientsToCheck.isEmpty() && !timeout.hasTimedOut());
for (SolrClient client : clients) {
assertEquals("commitWithin did not work on node: " + ((HttpSolrClient)client).getBaseURL(), before + 1, client.query(new SolrQuery("*:*")).getResults().getNumFound());
}
assertTrue("commitWithin did not work on some nodes: "+clientsToCheck, clientsToCheck.isEmpty());
// TODO: This test currently fails because debug info is obtained only
// on shards with matches.