mirror of https://github.com/apache/lucene.git
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:
parent
72c1b74d5c
commit
06fdfe6f32
|
@ -296,21 +296,25 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure all cores have been assigned a id in cloudstate
|
// make sure all cores have been assigned a id in cloudstate
|
||||||
|
int cloudStateSliceCount = 0;
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++) {
|
||||||
|
cloudStateSliceCount = 0;
|
||||||
reader.updateClusterState(true);
|
reader.updateClusterState(true);
|
||||||
ClusterState state = reader.getClusterState();
|
ClusterState state = reader.getClusterState();
|
||||||
Map<String,Slice> slices = state.getSlices("collection1");
|
Map<String,Slice> slices = state.getSlices("collection1");
|
||||||
int count = 0;
|
|
||||||
for (String name : slices.keySet()) {
|
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);
|
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++) {
|
for (int i = 0; i < 90; i++) {
|
||||||
int assignedCount = 0;
|
assignedCount = 0;
|
||||||
for (int j = 0; j < coreCount; j++) {
|
for (int j = 0; j < coreCount; j++) {
|
||||||
if (ids[j] != null) {
|
if (ids[j] != null) {
|
||||||
assignedCount++;
|
assignedCount++;
|
||||||
|
@ -321,6 +325,8 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
Thread.sleep(500);
|
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>();
|
final HashMap<String, AtomicInteger> counters = new HashMap<String,AtomicInteger>();
|
||||||
for (int i = 1; i < sliceCount+1; i++) {
|
for (int i = 1; i < sliceCount+1; i++) {
|
||||||
|
@ -874,4 +880,4 @@ public class OverseerTest extends SolrTestCaseJ4 {
|
||||||
return zkClient;
|
return zkClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue