浏览代码

HDFS-2657. TestHttpFSServer and TestServerWebApp are failing on trunk. (tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1221580 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 13 年之前
父节点
当前提交
8fe3dd3fea

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/server/TestHttpFSServer.java

@@ -20,8 +20,10 @@ package org.apache.hadoop.fs.http.server;
 
 import junit.framework.Assert;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.lib.service.security.DummyGroupMapping;
 import org.apache.hadoop.test.HFSTestCase;
 import org.apache.hadoop.test.HadoopUsersConfTestHelper;
 import org.apache.hadoop.test.TestDir;
@@ -66,6 +68,7 @@ public class TestHttpFSServer extends HFSTestCase {
     String fsDefaultName = TestHdfsHelper.getHdfsConf().get("fs.default.name");
     Configuration conf = new Configuration(false);
     conf.set("httpfs.hadoop.conf:fs.default.name", fsDefaultName);
+    conf.set("httpfs.groups." + CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING, DummyGroupMapping.class.getName());
     File hoopSite = new File(new File(homeDir, "conf"), "httpfs-site.xml");
     OutputStream os = new FileOutputStream(hoopSite);
     conf.writeXml(os);

+ 34 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java

@@ -0,0 +1,34 @@
+package org.apache.hadoop.lib.service.security;
+
+import org.apache.hadoop.security.GroupMappingServiceProvider;
+import org.apache.hadoop.test.HadoopUsersConfTestHelper;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public class DummyGroupMapping implements GroupMappingServiceProvider {
+
+  @Override
+  @SuppressWarnings("unchecked")
+  public List<String> getGroups(String user) throws IOException {
+    if (user.equals("root")) {
+      return Arrays.asList("admin");
+    }
+    else if (user.equals("nobody")) {
+      return Arrays.asList("nobody");
+    } else {
+      String[] groups = HadoopUsersConfTestHelper.getHadoopUserGroups(user);
+      return (groups != null) ? Arrays.asList(groups) : Collections.EMPTY_LIST;
+    }
+  }
+
+  @Override
+  public void cacheGroupsRefresh() throws IOException {
+  }
+
+  @Override
+  public void cacheGroupsAdd(List<String> groups) throws IOException {
+  }
+}

+ 0 - 0
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/TestServerWebApp1.properties → hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/testserverwebapp1.properties


+ 0 - 2
hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/TestServerWebApp2.properties → hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/testserverwebapp2.properties

@@ -11,5 +11,3 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
-# 
-#

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -182,6 +182,9 @@ Trunk (unreleased changes)
 
     HDFS-2646. Hadoop HttpFS introduced 4 findbug warnings. (tucu)
 
+    HDFS-2657. TestHttpFSServer and TestServerWebApp are failing on trunk. 
+    (tucu)
+
 Release 0.23.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES