Skip to content

Commit d1be8b3

Browse files
committed
create
1 parent 5fbd0f9 commit d1be8b3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceComputerTests.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -600,16 +600,15 @@ public ShardAllocationDecision decideShardAllocation(ShardRouting shard, Routing
600600

601601
final var dataNodeIds = clusterState.nodes().getDataNodes().keySet();
602602
for (var nodeId : List.of("node-0", "node-1")) {
603-
final var desiredBalanceInput = new DesiredBalanceInput(
603+
final var desiredBalanceInput = DesiredBalanceInput.create(
604604
randomInt(),
605605
new RoutingAllocation(new AllocationDeciders(List.of(new AllocationDecider() {
606606
@Override
607607
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
608608
// Move command works every decision except NO
609609
return randomFrom(Decision.YES, Decision.THROTTLE, Decision.NOT_PREFERRED);
610610
}
611-
})), clusterState, ClusterInfo.EMPTY, SnapshotShardSizeInfo.EMPTY, 0L),
612-
List.of()
611+
})), clusterState, ClusterInfo.EMPTY, SnapshotShardSizeInfo.EMPTY, 0L)
613612
);
614613
var desiredBalance = desiredBalanceComputer.compute(
615614
DesiredBalance.BECOME_MASTER_INITIAL,
@@ -662,16 +661,15 @@ public ShardAllocationDecision decideShardAllocation(ShardRouting shard, Routing
662661
}
663662
clusterState = rebuildRoutingTable(clusterState, routingNodes);
664663

665-
final var dataNodeIds = clusterState.nodes().getDataNodes().keySet();
666-
final var desiredBalanceInput = new DesiredBalanceInput(
664+
final var desiredBalanceInput = DesiredBalanceInput.create(
667665
randomInt(),
668666
new RoutingAllocation(new AllocationDeciders(List.of(new AllocationDecider() {
669667
@Override
670668
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {
669+
// Always return NO so that AllocationCommands will silently fail.
671670
return Decision.NO;
672671
}
673-
})), clusterState, ClusterInfo.EMPTY, SnapshotShardSizeInfo.EMPTY, 0L),
674-
List.of()
672+
})), clusterState, ClusterInfo.EMPTY, SnapshotShardSizeInfo.EMPTY, 0L)
675673
);
676674
var desiredBalance = desiredBalanceComputer.compute(
677675
DesiredBalance.BECOME_MASTER_INITIAL,

0 commit comments

Comments
 (0)