2727import org .elasticsearch .cluster .ClusterStateTaskExecutor ;
2828import org .elasticsearch .cluster .metadata .IndexMetaData ;
2929import org .elasticsearch .cluster .metadata .MetaData ;
30- import org .elasticsearch .cluster .node .DiscoveryNode ;
3130import org .elasticsearch .cluster .node .DiscoveryNodes ;
3231import org .elasticsearch .cluster .routing .GroupShardsIterator ;
3332import org .elasticsearch .cluster .routing .RoutingNodes ;
5756import java .util .function .Function ;
5857import java .util .stream .Collectors ;
5958import java .util .stream .IntStream ;
60- import java .util .stream .StreamSupport ;
6159
6260import static org .elasticsearch .common .settings .Settings .settingsBuilder ;
6361import static org .hamcrest .CoreMatchers .equalTo ;
@@ -142,7 +140,7 @@ public void testIllegalShardFailureRequests() throws Exception {
142140 List <ShardStateAction .ShardRoutingEntry > failingTasks = createExistingShards (currentState , reason );
143141 List <ShardStateAction .ShardRoutingEntry > tasks = new ArrayList <>();
144142 for (ShardStateAction .ShardRoutingEntry failingTask : failingTasks ) {
145- tasks .add (new ShardStateAction .ShardRoutingEntry (failingTask .getShardRouting (), randomInvalidIdentity (currentState , failingTask .getShardRouting ()), failingTask .message , failingTask .failure ));
143+ tasks .add (new ShardStateAction .ShardRoutingEntry (failingTask .getShardRouting (), randomInvalidSourceShard (currentState , failingTask .getShardRouting ()), failingTask .message , failingTask .failure ));
146144 }
147145 Map <ShardStateAction .ShardRoutingEntry , ClusterStateTaskExecutor .TaskResult > taskResultMap =
148146 tasks .stream ().collect (Collectors .toMap (
@@ -275,11 +273,11 @@ private static void assertTaskResults(
275273 private static List <ShardStateAction .ShardRoutingEntry > toTasks (ClusterState currentState , List <ShardRouting > shards , String indexUUID , String message ) {
276274 return shards
277275 .stream ()
278- .map (shard -> new ShardStateAction .ShardRoutingEntry (shard , randomValidIdentity (currentState , shard ), message , new CorruptIndexException ("simulated" , indexUUID )))
276+ .map (shard -> new ShardStateAction .ShardRoutingEntry (shard , randomValidSourceShard (currentState , shard ), message , new CorruptIndexException ("simulated" , indexUUID )))
279277 .collect (Collectors .toList ());
280278 }
281279
282- private static ShardRouting randomValidIdentity (ClusterState currentState , ShardRouting shardRouting ) {
280+ private static ShardRouting randomValidSourceShard (ClusterState currentState , ShardRouting shardRouting ) {
283281 // for the request node ID to be valid, either the request is
284282 // from the node the shard is assigned to, or the request is
285283 // from the node holding the primary shard
@@ -295,7 +293,7 @@ private static ShardRouting randomValidIdentity(ClusterState currentState, Shard
295293 }
296294 }
297295
298- private static ShardRouting randomInvalidIdentity (ClusterState currentState , ShardRouting shardRouting ) {
296+ private static ShardRouting randomInvalidSourceShard (ClusterState currentState , ShardRouting shardRouting ) {
299297 Set <ShardRouting > identities = new HashSet <>();
300298 ShardRouting primaryShard = primaryShard (currentState , shardRouting );
301299 for (ShardRouting shard : currentState .routingTable ().allShards ()) {
0 commit comments