Skip to content

Commit b22b781

Browse files
ensure no initializing shards before wiping the cluster during setup
1 parent df96e0d commit b22b781

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ protected final void beforeInternal() throws Exception {
368368
final Scope currentClusterScope = getCurrentClusterScope();
369369
Callable<Void> setup = () -> {
370370
cluster().beforeTest(random());
371+
ensureNoInitializingShardsBeforeWipingCluster();
371372
cluster().wipe(excludeTemplates());
372373
randomIndexTemplate();
373374
return null;
@@ -386,6 +387,16 @@ protected final void beforeInternal() throws Exception {
386387

387388
}
388389

390+
protected void ensureNoInitializingShardsBeforeWipingCluster() {
391+
logger.info("--> waiting for all initializing shards to complete within a reasonable time before wiping the cluster");
392+
assertNoTimeout(
393+
client().admin()
394+
.cluster()
395+
.health(new ClusterHealthRequest(TEST_REQUEST_TIMEOUT, "_all").waitForNoInitializingShards(true))
396+
.actionGet()
397+
);
398+
}
399+
389400
private void printTestMessage(String message) {
390401
if (isSuiteScopedTest(getClass()) && (getTestName().equals("<unknown>"))) {
391402
logger.info("[{}]: {} suite", getTestClass().getSimpleName(), message);

0 commit comments

Comments
 (0)