diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java index 3d9e651b1b9..6f954c1e76a 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java @@ -296,21 +296,25 @@ public class OverseerTest extends SolrTestCaseJ4 { } // make sure all cores have been assigned a id in cloudstate + int cloudStateSliceCount = 0; for (int i = 0; i < 40; i++) { + cloudStateSliceCount = 0; reader.updateClusterState(true); ClusterState state = reader.getClusterState(); Map slices = state.getSlices("collection1"); - int count = 0; for (String name : slices.keySet()) { - count += slices.get(name).getShards().size(); + cloudStateSliceCount += slices.get(name).getShards().size(); } - if (coreCount == count) break; + if (coreCount == cloudStateSliceCount) break; Thread.sleep(200); } + assertEquals("Unable to verify all cores have been assigned an id in cloudstate", + coreCount, cloudStateSliceCount); - // make sure all cores have been returned a id + // make sure all cores have been returned an id + int assignedCount = 0; for (int i = 0; i < 90; i++) { - int assignedCount = 0; + assignedCount = 0; for (int j = 0; j < coreCount; j++) { if (ids[j] != null) { assignedCount++; @@ -321,6 +325,8 @@ public class OverseerTest extends SolrTestCaseJ4 { } Thread.sleep(500); } + assertEquals("Unable to verify all cores have been returned an id", + coreCount, assignedCount); final HashMap counters = new HashMap(); for (int i = 1; i < sliceCount+1; i++) { @@ -874,4 +880,4 @@ public class OverseerTest extends SolrTestCaseJ4 { return zkClient; } -} \ No newline at end of file +}