Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 4b04d3f62 -> 909db1e3a


Prevent IndexLoadBalancerIT from hanging


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/909db1e3
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/909db1e3
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/909db1e3

Branch: refs/heads/4.x-HBase-1.0
Commit: 909db1e3af453227711918af23a45cebadbac66e
Parents: 4b04d3f
Author: Samarth <[email protected]>
Authored: Tue Jan 12 12:55:20 2016 -0800
Committer: Samarth <[email protected]>
Committed: Tue Jan 12 12:55:20 2016 -0800

----------------------------------------------------------------------
 .../index/balancer/IndexLoadBalancerIT.java     | 65 +++++++++-----------
 1 file changed, 29 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/909db1e3/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java
index 449dccf..07ebbdd 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/hbase/index/balancer/IndexLoadBalancerIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -52,10 +53,11 @@ import org.apache.phoenix.hbase.index.IndexTestingUtils;
 import org.apache.phoenix.hbase.index.Indexer;
 import org.apache.phoenix.hbase.index.master.IndexMasterObserver;
 import org.apache.phoenix.util.ConfigUtil;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.Timeout;
 
 @Category(NeedsOwnMiniClusterTest.class)
 public class IndexLoadBalancerIT {
@@ -63,6 +65,9 @@ public class IndexLoadBalancerIT {
     private static HBaseTestingUtility UTIL = new HBaseTestingUtility();
 
     private static HBaseAdmin admin = null;
+    
+    @Rule
+    public Timeout timeout = new Timeout(180, TimeUnit.SECONDS);
 
     @BeforeClass
     public static void setupCluster() throws Exception {
@@ -81,21 +86,8 @@ public class IndexLoadBalancerIT {
         UTIL.startMiniCluster(NUM_RS);
         admin = UTIL.getHBaseAdmin();
     }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-        try {
-            if (admin != null) {
-                admin.disableTables(".*");
-                admin.deleteTables(".*");
-                admin.close();
-            }
-        } finally {
-            UTIL.shutdownMiniCluster();
-        }
-    }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testRoundRobinAssignmentDuringIndexTableCreation() throws 
Exception {
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -108,8 +100,8 @@ public class IndexLoadBalancerIT {
                         .getNameAsString());
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testColocationAfterSplit() throws Exception {
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -161,8 +153,8 @@ public class IndexLoadBalancerIT {
                         .getNameAsString());
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testColocationAfterRegionsMerge() throws Exception {
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -253,8 +245,8 @@ public class IndexLoadBalancerIT {
         table.put(p4);
         admin.flush(tableName.getNameAsString());
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testRandomAssignmentDuringIndexTableEnable() throws Exception {
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -273,8 +265,8 @@ public class IndexLoadBalancerIT {
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
 
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testBalanceCluster() throws Exception {
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -305,10 +297,10 @@ public class IndexLoadBalancerIT {
                         .getNameAsString());
         assertTrue("User regions and index regions should colocate.", 
isRegionsColocated);
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testBalanceByTable() throws Exception {
-        ZooKeeperWatcher zkw = UTIL.getZooKeeperWatcher(UTIL);
+        ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
         
master.getConfiguration().setBoolean("hbase.master.loadbalance.bytable", true);
@@ -342,10 +334,10 @@ public class IndexLoadBalancerIT {
                         .getNameAsString());
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testRoundRobinAssignmentAfterRegionServerDown() throws 
Exception {
-        ZooKeeperWatcher zkw = UTIL.getZooKeeperWatcher(UTIL);
+        ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
         TableName tableName = 
TableName.valueOf("testRoundRobinAssignmentAfterRegionServerDown");
@@ -367,10 +359,10 @@ public class IndexLoadBalancerIT {
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
 
     }
-
-    @Test(timeout = 180000)
+    
+    @Test
     public void testRetainAssignmentDuringMasterStartUp() throws Exception {
-        ZooKeeperWatcher zkw = UTIL.getZooKeeperWatcher(UTIL);
+        ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(UTIL);
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
         
master.getConfiguration().setBoolean("hbase.master.startup.retainassign", true);
@@ -396,8 +388,8 @@ public class IndexLoadBalancerIT {
         assertTrue("User regions and index regions should colocate.", 
isRegionColocated);
 
     }
-
-    @Test(timeout = 300000)
+    
+    @Test
     public void testRoundRobinAssignmentDuringMasterStartUp() throws Exception 
{
         MiniHBaseCluster cluster = UTIL.getHBaseCluster();
         HMaster master = cluster.getMaster();
@@ -461,7 +453,8 @@ public class IndexLoadBalancerIT {
         return startKeyAndLocationPairs;
 
     }
-
+    
+    @Test
     public boolean checkForColocation(HMaster master, String tableName, String 
indexTableName)
             throws IOException, InterruptedException {
         List<Pair<byte[], ServerName>> uTableStartKeysAndLocations =

Reply via email to