Skip to content

Commit ded53a3

Browse files
Fix assertion in DiskThresholdDeciderIT (part 2) (#127846) (#128033)
Fixes the final assertion in testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleRestores() that wasn't addressed with the fix in PR 127615 for issue 127286. Closes #127787 Co-authored-by: David Turner <[email protected]> (cherry picked from commit 98296d7)
1 parent 1fc6ec1 commit ded53a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleResto
280280
tinyNodeShardIds.size() + tinyNodeShardIdsCopy.size(),
281281
is(1)
282282
);
283-
assertThat(tinyNodeShardIds.iterator().next(), in(shardSizes.getShardIdsWithSizeSmallerOrEqual(usableSpace)));
283+
final var useableSpaceShardSizes = shardSizes.getShardIdsWithSizeSmallerOrEqual(usableSpace);
284+
final var tinyNodeShardId = tinyNodeShardIds.isEmpty() == false
285+
? tinyNodeShardIds.iterator().next()
286+
// shardSizes only contains the sizes from the original index, not the copy, so we map the copied shard back to the original idx
287+
: new ShardId(useableSpaceShardSizes.iterator().next().getIndex(), tinyNodeShardIdsCopy.iterator().next().id());
288+
assertThat(tinyNodeShardId, in(useableSpaceShardSizes));
284289
}
285290

286291
private Set<ShardId> getShardIds(final String nodeId, final String indexName) {

0 commit comments

Comments
 (0)