Skip to content

Commit c2f6c4e

Browse files
committed
fixup! Rename shard failure task classifications
1 parent 408aca4 commit c2f6c4e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

core/src/test/java/org/elasticsearch/cluster/action/shard/ShardFailedClusterStateTaskExecutorTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.cluster.ClusterStateTaskExecutor;
2828
import org.elasticsearch.cluster.metadata.IndexMetaData;
2929
import org.elasticsearch.cluster.metadata.MetaData;
30-
import org.elasticsearch.cluster.node.DiscoveryNode;
3130
import org.elasticsearch.cluster.node.DiscoveryNodes;
3231
import org.elasticsearch.cluster.routing.GroupShardsIterator;
3332
import org.elasticsearch.cluster.routing.RoutingNodes;
@@ -57,7 +56,6 @@
5756
import java.util.function.Function;
5857
import java.util.stream.Collectors;
5958
import java.util.stream.IntStream;
60-
import java.util.stream.StreamSupport;
6159

6260
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
6361
import 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

Comments
 (0)