File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
test/framework/src/main/java/org/elasticsearch/test Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments