SOLR-11452: Leader from collectionState can be null

This commit is contained in:
Cao Manh Dat 2017-10-30 10:04:08 +07:00
parent e0239b9e84
commit cc519b9ddd
1 changed files with 6 additions and 2 deletions

View File

@ -676,8 +676,12 @@ public class TestTlogReplica extends SolrCloudTestCase {
String oldLeaderNodeName = oldLeaderJetty.getNodeName();
ChaosMonkey.kill(oldLeaderJetty);
waitForState("Replica not removed", collectionName, activeReplicaCount(0, 1, 0));
waitForState("Expect new leader", collectionName, (liveNodes, collectionState) ->
!collectionState.getLeader("shard1").getNodeName().equals(oldLeaderNodeName)
waitForState("Expect new leader", collectionName,
(liveNodes, collectionState) -> {
Replica leader = collectionState.getLeader("shard1");
if (leader == null) return false;
return !leader.getNodeName().equals(oldLeaderNodeName);
}
);
ChaosMonkey.start(oldLeaderJetty);
waitForState("Replica not added", collectionName, activeReplicaCount(0, 2, 0));