Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,12 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleResto
tinyNodeShardIds.size() + tinyNodeShardIdsCopy.size(),
is(1)
);
assertThat(tinyNodeShardIds.iterator().next(), in(shardSizes.getShardIdsWithSizeSmallerOrEqual(usableSpace)));
final var useableSpaceShardSizes = shardSizes.getShardIdsWithSizeSmallerOrEqual(usableSpace);
final var tinyNodeShardId = tinyNodeShardIds.isEmpty() == false
? tinyNodeShardIds.iterator().next()
// shardSizes only contains the sizes from the original index, not the copy, so we map the copied shard back to the original idx
: new ShardId(useableSpaceShardSizes.iterator().next().getIndex(), tinyNodeShardIdsCopy.iterator().next().id());
assertThat(tinyNodeShardId, in(useableSpaceShardSizes));
}

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