SOLR-9132: Fix request-counting logic in ConnectionReuseTest

This commit is contained in:
Alan Woodward 2016-05-23 15:25:25 +01:00
parent 3f358dda9c
commit 6c37541618
1 changed files with 8 additions and 2 deletions

View File

@ -78,7 +78,12 @@ public class ConnectionReuseTest extends SolrCloudTestCase {
switch (random().nextInt(3)) { switch (random().nextInt(3)) {
case 0: case 0:
// currently only testing with 1 thread // currently only testing with 1 thread
return getConcurrentUpdateSolrClient(url.toString() + "/" + COLLECTION, httpClient, 6, 1); return new ConcurrentUpdateSolrClient(url.toString() + "/" + COLLECTION, httpClient, 6, 1) {
@Override
public void handleError(Throwable ex) {
// we're expecting random errors here, don't spam the logs
}
};
case 1: case 1:
return getHttpSolrClient(url.toString() + "/" + COLLECTION, httpClient); return getHttpSolrClient(url.toString() + "/" + COLLECTION, httpClient);
case 2: case 2:
@ -130,6 +135,7 @@ public class ConnectionReuseTest extends SolrCloudTestCase {
} }
if (!done && i > 0 && i < cnt2 - 1 && client instanceof ConcurrentUpdateSolrClient if (!done && i > 0 && i < cnt2 - 1 && client instanceof ConcurrentUpdateSolrClient
&& random().nextInt(10) > 8) { && random().nextInt(10) > 8) {
log.info("Pausing - should start a new request");
queueBreaks++; queueBreaks++;
done = true; done = true;
Thread.sleep(350); // wait past streaming client poll time of 250ms Thread.sleep(350); // wait past streaming client poll time of 250ms
@ -160,7 +166,7 @@ public class ConnectionReuseTest extends SolrCloudTestCase {
// we can't fully control queue polling breaking up requests - allow a bit of leeway // we can't fully control queue polling breaking up requests - allow a bit of leeway
log.info("Outer loop count: {}", cnt1); log.info("Outer loop count: {}", cnt1);
log.info("Queue breaks: {}", queueBreaks); log.info("Queue breaks: {}", queueBreaks);
int exp = cnt1 + queueBreaks + 2; int exp = queueBreaks + 3;
log.info("Expected: {}", exp); log.info("Expected: {}", exp);
log.info("Requests: {}", metrics.getRequestCount()); log.info("Requests: {}", metrics.getRequestCount());
assertTrue( assertTrue(