lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1379014 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
Date Thu, 30 Aug 2012 16:48:56 GMT
Author: hossman
Date: Thu Aug 30 16:48:55 2012
New Revision: 1379014

URL: http://svn.apache.org/viewvc?rev=1379014&view=rev
Log:
SOLR-3768: add some prelim assertions to OverseerTest

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java?rev=1379014&r1=1379013&r2=1379014&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java Thu Aug 30
16:48:55 2012
@@ -296,21 +296,25 @@ public class OverseerTest extends SolrTe
       }
       
       // 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
+      // 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 SolrTe
         }
         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++) {
@@ -874,4 +880,4 @@ public class OverseerTest extends SolrTe
     return zkClient;
   }
   
-}
\ No newline at end of file
+}



Mime
View raw message