SOLR-8249: Addressing the test failures due to Leader election changes

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1713231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-11-08 14:42:32 +00:00
parent 4caac50712
commit a238b5ee6f
1 changed files with 11 additions and 1 deletions

View File

@ -718,8 +718,17 @@ public class OverseerTest extends SolrTestCaseJ4 {
mockController.publishState(collection, "core1", "core_node1", Replica.State.RECOVERING, 1);
// Wait till the leader election has finished
long maxWaitTimeForLeaderElection = 5000;
for (int i = 0; i < maxWaitTimeForLeaderElection / 200; i++) {
if (overseer.getStats().getSuccessCount(OverseerAction.LEADER.toLower()) > 0) {
break;
}
Thread.sleep(200);
}
assertNotNull(overseer.getStats());
assertEquals(1, (overseer.getStats().getSuccessCount(OverseerAction.STATE.toLower())));
assertEquals(1, (overseer.getStats().getSuccessCount(OverseerAction.LEADER.toLower())));
assertTrue((overseer.getStats().getSuccessCount(OverseerAction.STATE.toLower())) > 0);
// shut it down
overseer.close();
@ -730,6 +739,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
overseerElector.joinElection(ec, false);
assertNotNull(overseer.getStats());
assertEquals(0, (overseer.getStats().getSuccessCount(OverseerAction.STATE.toLower())));
assertEquals(0, (overseer.getStats().getSuccessCount(OverseerAction.LEADER.toLower())));
} finally {
close(mockController);