Skip to content

Commit 98296d7

Browse files
Fix assertion in DiskThresholdDeciderIT (part 2) (#127846)
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]>
1 parent d6c8159 commit 98296d7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

muted-tests.yml

-3
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,6 @@ tests:
447447
- class: org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT
448448
method: test {p0=esql/120_profile/avg 8.14 or after}
449449
issue: https://github.com/elastic/elasticsearch/issues/127879
450-
- class: org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDeciderIT
451-
method: testRestoreSnapshotAllocationDoesNotExceedWatermarkWithMultipleRestores
452-
issue: https://github.com/elastic/elasticsearch/issues/127787
453450
- class: org.elasticsearch.indices.stats.IndexStatsIT
454451
method: testThrottleStats
455452
issue: https://github.com/elastic/elasticsearch/issues/126359

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

+6-1
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)