use of org.apache.solr.util.RTimer in project lucene-solr by apache.
the class BasicDistributedZkTest method waitForDocCount.
// Insure that total docs found is the expected number.
private void waitForDocCount(long expectedNumFound, long waitMillis, String failureMessage) throws Exception {
RTimer timer = new RTimer();
long timeout = (long) timer.getTime() + waitMillis;
ClusterState clusterState = getCommonCloudSolrClient().getZkStateReader().getClusterState();
DocCollection dColl = clusterState.getCollection(DEFAULT_COLLECTION);
// Could use this for 0 hits too!
long docTotal = -1;
while (docTotal != expectedNumFound && timeout > (long) timer.getTime()) {
docTotal = checkSlicesSameCounts(dColl);
if (docTotal != expectedNumFound) {
Thread.sleep(100);
}
}
// We could fail here if we broke out of the above because we exceeded the time allowed.
assertEquals(failureMessage, expectedNumFound, docTotal);
// This should be redundant, but it caught a test error after all.
for (SolrClient client : clients) {
assertEquals(failureMessage, expectedNumFound, client.query(new SolrQuery("*:*")).getResults().getNumFound());
}
}
Aggregations