hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1066892 - in /hive/trunk: CHANGES.txt hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
Date Thu, 03 Feb 2011 17:47:09 GMT
Author: namit
Date: Thu Feb  3 17:47:09 2011
New Revision: 1066892

URL: http://svn.apache.org/viewvc?rev=1066892&view=rev
Log:
HIVE-1716 Make TestHBaseCliDriver use dynamic ports to avoid conflicts with
already-running services (John Sichi via namit)


Modified:
    hive/trunk/CHANGES.txt
    hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java

Modified: hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hive/trunk/CHANGES.txt?rev=1066892&r1=1066891&r2=1066892&view=diff
==============================================================================
--- hive/trunk/CHANGES.txt (original)
+++ hive/trunk/CHANGES.txt Thu Feb  3 17:47:09 2011
@@ -749,6 +749,9 @@ Trunk -  Unreleased
     HIVE-1944 Dynamic partition insert creating different directories for the
     same partition during merge (Ning Zhang via namit)
 
+    HIVE-1716 Make TestHBaseCliDriver use dynamic ports to avoid conflicts with
+    already-running services (John Sichi via namit)
+
   TESTS
 
     HIVE-1464. improve  test query performance

Modified: hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java?rev=1066892&r1=1066891&r2=1066892&view=diff
==============================================================================
--- hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java (original)
+++ hive/trunk/hbase-handler/src/test/org/apache/hadoop/hive/hbase/HBaseTestSetup.java Thu
Feb  3 17:47:09 2011
@@ -19,6 +19,8 @@
 package org.apache.hadoop.hive.hbase;
 
 import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
 
 import junit.extensions.TestSetup;
 import junit.framework.Test;
@@ -81,12 +83,23 @@ public class HBaseTestSetup extends Test
     conf.set("hbase.zookeeper.property.clientPort",
       Integer.toString(zooKeeperPort));
     HBaseConfiguration hbaseConf = new HBaseConfiguration(conf);
+    hbaseConf.setInt("hbase.master.port", findFreePort());
+    hbaseConf.setInt("hbase.master.info.port", -1);
+    hbaseConf.setInt("hbase.regionserver.port", findFreePort());
+    hbaseConf.setInt("hbase.regionserver.info.port", -1);
     hbaseCluster = new MiniHBaseCluster(hbaseConf, NUM_REGIONSERVERS);
     conf.set("hbase.master", hbaseCluster.getHMasterAddress().toString());
     // opening the META table ensures that cluster is running
     new HTable(new HBaseConfiguration(conf), HConstants.META_TABLE_NAME);
   }
 
+  private static int findFreePort() throws IOException {
+    ServerSocket server = new ServerSocket(0);
+    int port = server.getLocalPort();
+    server.close();
+    return port;
+  }
+
   @Override
   protected void tearDown() throws Exception {
     if (hbaseCluster != null) {



Mime
View raw message