diff --git a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java index 6ac7e886c6b..9004b9113f5 100644 --- a/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/hdfs/StressHdfsTest.java @@ -198,6 +198,16 @@ public class StressHdfsTest extends BasicDistributedZkTest { request.setPath("/admin/collections"); cloudClient.request(request); + long timeout = System.currentTimeMillis() + 10000; + while (cloudClient.getZkStateReader().getClusterState().hasCollection(DELETE_DATA_DIR_COLLECTION)) { + if (System.currentTimeMillis() > timeout) { + throw new AssertionError("Timeout waiting to see removed collection leave clusterstate"); + } + + Thread.sleep(200); + cloudClient.getZkStateReader().updateClusterState(true); + } + // check that all dirs are gone for (String dataDir : dataDirs) { Configuration conf = new Configuration();