SOLR-3768: add some prelim assertions to OverseerTest

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1379014 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2012-08-30 16:48:55 +00:00
parent 72c1b74d5c
commit 06fdfe6f32
1 changed files with 12 additions and 6 deletions

View File

@ -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<String,Slice> 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
for (int i = 0; i < 90; i++) {
// make sure all cores have been returned an id
int assignedCount = 0;
for (int i = 0; i < 90; i++) {
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<String, AtomicInteger> counters = new HashMap<String,AtomicInteger>();
for (int i = 1; i < sliceCount+1; i++) {