Skip to content

Commit 0cd3ff5

Browse files
authored
Fix AllocationFailuresResetOnShutdownIT#testResetAllocationFailuresOnNodeShutdown (#121378)
The ITs assumes that `ensureRed` means we've exhausted all the attempts for allocation, which doesn't hold always. Closes #121129
1 parent 12a7166 commit 0cd3ff5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ tests:
268268
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
269269
method: test {p0=nodes.stats/11_indices_metrics/indices mappings exact count test for indices level}
270270
issue: https://github.com/elastic/elasticsearch/issues/120950
271-
- class: org.elasticsearch.xpack.shutdown.AllocationFailuresResetOnShutdownIT
272-
method: testResetAllocationFailuresOnNodeShutdown
273-
issue: https://github.com/elastic/elasticsearch/issues/121129
274271
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
275272
method: testActivateProfileForJWT
276273
issue: https://github.com/elastic/elasticsearch/issues/120983

x-pack/plugin/shutdown/src/internalClusterTest/java/org/elasticsearch/xpack/shutdown/AllocationFailuresResetOnShutdownIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,18 @@ public void beforeIndexShardCreated(ShardRouting routing, Settings indexSettings
175175

176176
prepareCreate("index1", indexSettings(1, 0)).execute();
177177

178-
// await all relocation attempts are exhausted
178+
// await all allocation attempts are exhausted
179179
var maxAttempts = MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY.get(Settings.EMPTY);
180180
ensureRed("index1");
181-
{
181+
assertBusy(() -> {
182182
var state = safeGet(clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).execute()).getState();
183183
var index = state.getRoutingTable().index("index1");
184184
assertNotNull(index);
185185
var shard = index.shard(0).primaryShard();
186186
assertNotNull(shard);
187187
assertNotNull(shard.unassignedInfo());
188188
assertThat(maxAttempts, equalTo(shard.unassignedInfo().failedAllocations()));
189-
}
189+
});
190190

191191
failAllocation.set(false);
192192

@@ -240,13 +240,13 @@ public void beforeIndexShardCreated(ShardRouting routing, Settings indexSettings
240240
// await all allocation attempts are exhausted
241241
var maxAttempts = MaxRetryAllocationDecider.SETTING_ALLOCATION_MAX_RETRY.get(Settings.EMPTY);
242242
ensureRed("index1");
243-
{
243+
assertBusy(() -> {
244244
var state = safeGet(clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).execute()).getState();
245245
var shard = state.getRoutingTable().index("index1").shard(0).primaryShard();
246246
assertNotNull(shard);
247247
assertNotNull(shard.unassignedInfo());
248248
assertThat(maxAttempts, equalTo(shard.unassignedInfo().failedAllocations()));
249-
}
249+
});
250250

251251
failAllocation.set(false);
252252

0 commit comments

Comments
 (0)