You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2016/11/01 19:48:01 UTC

[23/50] hbase git commit: HBASE-16375 Mapreduce mini cluster using HBaseTestingUtility not setting correct resourcemanager and jobhistory webapp address of MapReduceTestingShim

HBASE-16375 Mapreduce mini cluster using HBaseTestingUtility not setting correct resourcemanager and jobhistory webapp address of MapReduceTestingShim

Signed-off-by: Andrew Purtell <ap...@apache.org>
Amending-Author: Andrew Purtell <ap...@apache.org>

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/51a5fe85
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/51a5fe85
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/51a5fe85

Branch: refs/heads/0.98
Commit: 51a5fe85015998b017820fc83ad6ee2aa74b4bda
Parents: a7e6860
Author: Loknath Priyatham Teja Singamsetty <si...@gmail.com>
Authored: Thu Sep 1 21:16:26 2016 +0530
Committer: Andrew Purtell <ap...@apache.org>
Committed: Thu Sep 1 16:21:41 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/HBaseTestingUtility.java       | 10 +++++
 .../hadoop/hbase/TestHBaseTestingUtility.java   | 39 ++++++++++++++++++++
 2 files changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/51a5fe85/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
index 9c1e42c..641258d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
@@ -2363,6 +2363,16 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility {
     if (schedulerAddress != null) {
       conf.set("yarn.resourcemanager.scheduler.address", schedulerAddress);
     }
+    String mrJobHistoryWebappAddress =
+      jobConf.get("mapreduce.jobhistory.webapp.address");
+    if (mrJobHistoryWebappAddress != null) {
+      conf.set("mapreduce.jobhistory.webapp.address", mrJobHistoryWebappAddress);
+    }
+    String yarnRMWebappAddress =
+      jobConf.get("yarn.resourcemanager.webapp.address");
+    if (yarnRMWebappAddress != null) {
+      conf.set("yarn.resourcemanager.webapp.address", yarnRMWebappAddress);
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/51a5fe85/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java
index c4f232f..19e058d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestHBaseTestingUtility.java
@@ -23,6 +23,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileSystem;
@@ -223,5 +231,36 @@ public class TestHBaseTestingUtility {
     assertTrue(hbt.cleanupTestDir());
   }
 
+  @Test public void testMRYarnConfigsPopulation() throws IOException {
+    Map<String, String> dummyProps = new HashMap<String, String>();
+    dummyProps.put("mapreduce.jobtracker.address", "dummyhost:11234");
+    dummyProps.put("yarn.resourcemanager.address", "dummyhost:11235");
+    dummyProps.put("mapreduce.jobhistory.address", "dummyhost:11236");
+    dummyProps.put("yarn.resourcemanager.scheduler.address", "dummyhost:11237");
+    dummyProps.put("mapreduce.jobhistory.webapp.address", "dummyhost:11238");
+    dummyProps.put("yarn.resourcemanager.webapp.address", "dummyhost:11239");
+  
+    HBaseTestingUtility hbt = new HBaseTestingUtility();
+    
+    // populate the mr props to the Configuration instance
+    for (Entry<String, String> entry : dummyProps.entrySet()) {
+      hbt.getConfiguration().set(entry.getKey(), entry.getValue());
+    }
+    
+    for (Entry<String,String> entry : dummyProps.entrySet()) {
+      assertTrue("The Configuration for key " + entry.getKey() +" and value: " + entry.getValue() +
+                 " is not populated correctly", hbt.getConfiguration().get(entry.getKey()).equals(entry.getValue()));
+    }
+
+    hbt.startMiniMapReduceCluster();
+    
+    // Confirm that MiniMapReduceCluster overwrites the mr properties and updates the Configuration 
+    for (Entry<String,String> entry : dummyProps.entrySet()) {
+      assertFalse("The MR prop: " + entry.getValue() + " is not overwritten when map reduce mini"+
+                  "cluster is started", hbt.getConfiguration().get(entry.getKey()).equals(entry.getValue()));
+    }
+    
+    hbt.shutdownMiniMapReduceCluster();
+  }
 }