Fix ReplicaShardAllocatorTests when unassigned reason is ALLOCATION_FAILED
When mocking unassigned shards which have failed with reason ALLOCATION_FAILED we have to ensure that the failed allocation counter is strictly positive.
This commit is contained in:
parent
f5c0b34c90
commit
f98ca5310c
|
@ -291,12 +291,14 @@ public class ReplicaShardAllocatorTests extends ESAllocationTestCase {
|
||||||
// mark shard as delayed if reason is NODE_LEFT
|
// mark shard as delayed if reason is NODE_LEFT
|
||||||
boolean delayed = reason == UnassignedInfo.Reason.NODE_LEFT &&
|
boolean delayed = reason == UnassignedInfo.Reason.NODE_LEFT &&
|
||||||
UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(settings).nanos() > 0;
|
UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(settings).nanos() > 0;
|
||||||
|
int failedAllocations = reason == UnassignedInfo.Reason.ALLOCATION_FAILED ? 1 : 0;
|
||||||
RoutingTable routingTable = RoutingTable.builder()
|
RoutingTable routingTable = RoutingTable.builder()
|
||||||
.add(IndexRoutingTable.builder(shardId.getIndex())
|
.add(IndexRoutingTable.builder(shardId.getIndex())
|
||||||
.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
|
.addIndexShard(new IndexShardRoutingTable.Builder(shardId)
|
||||||
.addShard(primaryShard)
|
.addShard(primaryShard)
|
||||||
.addShard(ShardRouting.newUnassigned(shardId, null, false,
|
.addShard(ShardRouting.newUnassigned(shardId, null, false,
|
||||||
new UnassignedInfo(reason, null, null, 0, System.nanoTime(), System.currentTimeMillis(), delayed)))
|
new UnassignedInfo(reason, null, null, failedAllocations, System.nanoTime(),
|
||||||
|
System.currentTimeMillis(), delayed)))
|
||||||
.build())
|
.build())
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
Loading…
Reference in New Issue