Browse Source

HDFS-1164. TestHdfsProxy is failing. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security@1160489 13f79535-47bb-0310-9956-ffa450edef68
Jitendra Nath Pandey 13 years ago
parent
commit
5288153f4e

+ 2 - 0
CHANGES.txt

@@ -91,6 +91,8 @@ Release 0.20.205.0 - unreleased
     HDFS-1211. Block receiver should not log "rewind" packets at INFO level.
     (Todd Lipcon)
 
+    HDFS-1164. TestHdfsProxy is failing. (Todd Lipcon)
+
 Release 0.20.204.0 - unreleased
 
   NEW FEATURES

+ 2 - 0
src/contrib/hdfsproxy/build.xml

@@ -156,6 +156,8 @@
         <include name="slf4j-api-${slf4j-api.version}.jar"/>
         <include name="slf4j-log4j12-${slf4j-log4j12.version}.jar"/>
         <include name="xmlenc-${xmlenc.version}.jar"/>
+	<include name="jetty-${jetty.version}.jar"/>
+	<include name="jetty-util-${jetty-util.version}.jar"/>
       </lib>
       <lib dir="${hadoop.root}/lib">
         <include name="hadoop-core-*.jar"/>

+ 9 - 5
src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java

@@ -41,6 +41,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
 import org.apache.hadoop.hdfs.server.datanode.DataNode;
 import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
 import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.authorize.ProxyUsers;
 
 /**
@@ -199,13 +200,16 @@ public class TestHdfsProxy extends TestCase {
     MiniDFSCluster cluster = null;
     HdfsProxy proxy = null;
     try {
+      final UserGroupInformation CLIENT_UGI = UserGroupInformation.getCurrentUser();
+      final String testUser = CLIENT_UGI.getShortUserName();
+      final String testGroup = CLIENT_UGI.getGroupNames()[0];
 
       final Configuration dfsConf = new Configuration();
-      dfsConf.set("hadoop.proxyuser." + System.getProperty("user.name") +
-          ".groups", "users");
-      dfsConf.set("hadoop.proxyuser.users.hosts", "127.0.0.1,localhost");
-      dfsConf.set("hadoop.proxyuser." + System.getProperty("user.name") +
-          ".hosts", "127.0.0.1,localhost");
+      dfsConf.set("hadoop.proxyuser." + testUser + ".groups", testGroup);
+      dfsConf.set("hadoop.proxyuser." + testGroup + ".hosts",
+          "127.0.0.1,localhost");
+      dfsConf.set("hadoop.proxyuser." + testUser + ".hosts",
+          "127.0.0.1,localhost");
       dfsConf.set("hadoop.security.authentication", "simple");
       
       //make sure server will look at the right config