Skip to content

Commit 58734f0

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

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,6 @@ tests:
452452
- class: org.elasticsearch.test.index.IndexVersionUtilsTests
453453
method: testIndexCompatibleVersionMatches
454454
issue: https://github.com/elastic/elasticsearch/issues/120760
455-
- class: org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDeciderIT
456-
method: testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleRestores
457-
issue: https://github.com/elastic/elasticsearch/issues/127787
458455
- class: org.elasticsearch.xpack.remotecluster.RemoteClusterSecurityFcActionAuthorizationIT
459456
method: testIndicesPrivilegesAreEnforcedForCcrRestoreSessionActions
460457
issue: https://github.com/elastic/elasticsearch/issues/127782

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)