accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1397113 - /accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java
Date Thu, 11 Oct 2012 15:36:28 GMT
Author: ecn
Date: Thu Oct 11 15:36:28 2012
New Revision: 1397113

URL: http://svn.apache.org/viewvc?rev=1397113&view=rev
Log:
ACCUMULO-770 randomize the list of potential locations when assigning tablets: fix unit test

Modified:
    accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java

Modified: accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java?rev=1397113&r1=1397112&r2=1397113&view=diff
==============================================================================
--- accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java
(original)
+++ accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java
Thu Oct 11 15:36:28 2012
@@ -138,9 +138,7 @@ public class DefaultLoadBalancerTest {
     
     // reassign offline extents
     assignTablets(remove.extents, servers, current, balancer);
-    
-    expectedCounts.put("t3", 3);
-    checkBalance(metadataTable, servers, expectedCounts);
+    checkBalance(metadataTable, servers, null);
   }
   
   private void assignTablets(List<KeyExtent> metadataTable, Map<TServerInstance,FakeTServer>
servers, SortedMap<TServerInstance,TabletServerStatus> status,
@@ -259,16 +257,18 @@ public class DefaultLoadBalancerTest {
         fail("average number of tablets is " + average + " but a server has " + server.extents.size());
     }
     
-    for (FakeTServer server : servers.values()) {
-      Map<String,Integer> counts = new HashMap<String,Integer>();
-      for (KeyExtent extent : server.extents) {
-        String t = extent.getTableId().toString();
-        if (counts.get(t) == null)
-          counts.put(t, 0);
-        counts.put(t, counts.get(t) + 1);
-      }
-      for (Entry<String,Integer> entry : counts.entrySet()) {
-        assertEquals(expectedCounts.get(entry.getKey()), counts.get(entry.getKey()));
+    if (expectedCounts != null) {
+      for (FakeTServer server : servers.values()) {
+        Map<String,Integer> counts = new HashMap<String,Integer>();
+        for (KeyExtent extent : server.extents) {
+          String t = extent.getTableId().toString();
+          if (counts.get(t) == null)
+            counts.put(t, 0);
+          counts.put(t, counts.get(t) + 1);
+        }
+        for (Entry<String,Integer> entry : counts.entrySet()) {
+          assertEquals(expectedCounts.get(entry.getKey()), counts.get(entry.getKey()));
+        }
       }
     }
   }



Mime
View raw message