summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java75
1 files changed, 37 insertions, 38 deletions
diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java
index fa52503eac..6c5862682f 100644
--- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java
+++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java
@@ -46,7 +46,6 @@ import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationComman
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.LocalTransportAddress;
-import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ESAllocationTestCase;
import org.elasticsearch.test.gateway.NoopGatewayAllocator;
@@ -320,8 +319,8 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
logger.info("--> adding node1 and node2 node");
clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder()
- .put(newNode("node1"))
- .put(newNode("node2"))
+ .put(newNode("node1"))
+ .put(newNode("node2"))
).build();
routingTable = strategy.reroute(clusterState, "reroute").routingTable();
@@ -504,7 +503,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
logger.info("--> adding node5");
clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes())
- .put(newNode("node5"))
+ .put(newNode("node5"))
).build();
routingTable = strategy.reroute(clusterState, "reroute").routingTable();
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
@@ -757,8 +756,8 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
logger.info("--> adding two nodes");
clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder()
- .put(newNode("node1"))
- .put(newNode("node2"))
+ .put(newNode("node1"))
+ .put(newNode("node2"))
).build();
routingTable = strategy.reroute(clusterState, "reroute").routingTable();
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
@@ -777,17 +776,17 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
logger.info("--> adding node3");
clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder(clusterState.nodes())
- .put(newNode("node3"))
+ .put(newNode("node3"))
).build();
- AllocationCommand relocate1 = new MoveAllocationCommand(new ShardId("test", 0), "node2", "node3");
+ AllocationCommand relocate1 = new MoveAllocationCommand("test", 0, "node2", "node3");
AllocationCommands cmds = new AllocationCommands(relocate1);
routingTable = strategy.reroute(clusterState, cmds).routingTable();
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
logShardStates(clusterState);
- AllocationCommand relocate2 = new MoveAllocationCommand(new ShardId("test2", 0), "node2", "node3");
+ AllocationCommand relocate2 = new MoveAllocationCommand("test2", 0, "node2", "node3");
cmds = new AllocationCommands(relocate2);
try {
@@ -848,14 +847,14 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
ShardRouting secondRouting = TestShardRouting.newShardRouting("test", 1, "node1", null, null, true, ShardRoutingState.STARTED, 1);
RoutingNode firstRoutingNode = new RoutingNode("node1", discoveryNode1, Arrays.asList(firstRouting, secondRouting));
RoutingTable.Builder builder = RoutingTable.builder().add(
- IndexRoutingTable.builder("test")
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 0))
- .addShard(firstRouting)
- .build()
+ IndexRoutingTable.builder(firstRouting.index())
+ .addIndexShard(new IndexShardRoutingTable.Builder(firstRouting.shardId())
+ .addShard(firstRouting)
+ .build()
)
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 1))
- .addShard(secondRouting)
- .build()
+ .addIndexShard(new IndexShardRoutingTable.Builder(secondRouting.shardId())
+ .addShard(secondRouting)
+ .build()
)
);
ClusterState clusterState = ClusterState.builder(baseClusterState).routingTable(builder.build()).build();
@@ -868,14 +867,14 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
secondRouting = TestShardRouting.newShardRouting("test", 1, "node1", "node2", null, true, ShardRoutingState.RELOCATING, 1);
firstRoutingNode = new RoutingNode("node1", discoveryNode1, Arrays.asList(firstRouting, secondRouting));
builder = RoutingTable.builder().add(
- IndexRoutingTable.builder("test")
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 0))
- .addShard(firstRouting)
- .build()
+ IndexRoutingTable.builder(firstRouting.index())
+ .addIndexShard(new IndexShardRoutingTable.Builder(firstRouting.shardId())
+ .addShard(firstRouting)
+ .build()
)
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 1))
- .addShard(secondRouting)
- .build()
+ .addIndexShard(new IndexShardRoutingTable.Builder(secondRouting.shardId())
+ .addShard(secondRouting)
+ .build()
)
);
clusterState = ClusterState.builder(baseClusterState).routingTable(builder.build()).build();
@@ -897,7 +896,7 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
}
};
AllocationDeciders deciders = new AllocationDeciders(Settings.EMPTY, new HashSet<>(Arrays.asList(
- new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider
+ new SameShardAllocationDecider(Settings.EMPTY), diskThresholdDecider
)));
AllocationService strategy = new AllocationService(settingsBuilder()
.put("cluster.routing.allocation.node_concurrent_recoveries", 10)
@@ -967,14 +966,14 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
RoutingNode firstRoutingNode = new RoutingNode("node2", discoveryNode2, Arrays.asList(firstRouting, secondRouting));
RoutingTable.Builder builder = RoutingTable.builder().add(
- IndexRoutingTable.builder("test")
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 0))
- .addShard(firstRouting)
- .build()
+ IndexRoutingTable.builder(firstRouting.index())
+ .addIndexShard(new IndexShardRoutingTable.Builder(firstRouting.shardId())
+ .addShard(firstRouting)
+ .build()
)
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 1))
- .addShard(secondRouting)
- .build()
+ .addIndexShard(new IndexShardRoutingTable.Builder(secondRouting.shardId())
+ .addShard(secondRouting)
+ .build()
)
);
ClusterState clusterState = ClusterState.builder(baseClusterState).routingTable(builder.build()).build();
@@ -1024,14 +1023,14 @@ public class DiskThresholdDeciderTests extends ESAllocationTestCase {
secondRouting = TestShardRouting.newShardRouting("test", 1, "node2", "node3", null, true, ShardRoutingState.RELOCATING, 1);
firstRoutingNode = new RoutingNode("node2", discoveryNode2, Arrays.asList(firstRouting, secondRouting));
builder = RoutingTable.builder().add(
- IndexRoutingTable.builder("test")
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 0))
- .addShard(firstRouting)
- .build()
+ IndexRoutingTable.builder(firstRouting.index())
+ .addIndexShard(new IndexShardRoutingTable.Builder(firstRouting.shardId())
+ .addShard(firstRouting)
+ .build()
)
- .addIndexShard(new IndexShardRoutingTable.Builder(new ShardId("test", 1))
- .addShard(secondRouting)
- .build()
+ .addIndexShard(new IndexShardRoutingTable.Builder(secondRouting.shardId())
+ .addShard(secondRouting)
+ .build()
)
);