svn merge -c 1477344 to branch-2 to fix HDFS-4687.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1503952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0623ee954a
commit
91469526ce
|
@ -479,6 +479,9 @@ Release 2.1.0-beta - 2013-07-02
|
||||||
|
|
||||||
HDFS-4999. Fix TestShortCircuitLocalRead on branch-2. (cmccabe via kihwal)
|
HDFS-4999. Fix TestShortCircuitLocalRead on branch-2. (cmccabe via kihwal)
|
||||||
|
|
||||||
|
HDFS-4687. TestDelegationTokenForProxyUser#testWebHdfsDoAs is flaky with
|
||||||
|
JDK7. (Andrew Wang via atm)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
|
BREAKDOWN OF HDFS-347 SUBTASKS AND RELATED JIRAS
|
||||||
|
|
||||||
HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.
|
HDFS-4353. Encapsulate connections to peers in Peer and PeerServer classes.
|
||||||
|
|
|
@ -60,24 +60,26 @@ import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.authorize.ProxyUsers;
|
import org.apache.hadoop.security.authorize.ProxyUsers;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
import org.junit.After;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestDelegationTokenForProxyUser {
|
public class TestDelegationTokenForProxyUser {
|
||||||
private MiniDFSCluster cluster;
|
private static MiniDFSCluster cluster;
|
||||||
Configuration config;
|
private static Configuration config;
|
||||||
final private static String GROUP1_NAME = "group1";
|
final private static String GROUP1_NAME = "group1";
|
||||||
final private static String GROUP2_NAME = "group2";
|
final private static String GROUP2_NAME = "group2";
|
||||||
final private static String[] GROUP_NAMES = new String[] { GROUP1_NAME,
|
final private static String[] GROUP_NAMES = new String[] { GROUP1_NAME,
|
||||||
GROUP2_NAME };
|
GROUP2_NAME };
|
||||||
final private static String REAL_USER = "RealUser";
|
final private static String REAL_USER = "RealUser";
|
||||||
final private static String PROXY_USER = "ProxyUser";
|
final private static String PROXY_USER = "ProxyUser";
|
||||||
|
private static UserGroupInformation ugi;
|
||||||
|
private static UserGroupInformation proxyUgi;
|
||||||
|
|
||||||
private static final Log LOG = LogFactory.getLog(TestDoAsEffectiveUser.class);
|
private static final Log LOG = LogFactory.getLog(TestDoAsEffectiveUser.class);
|
||||||
|
|
||||||
private void configureSuperUserIPAddresses(Configuration conf,
|
private static void configureSuperUserIPAddresses(Configuration conf,
|
||||||
String superUserShortName) throws IOException {
|
String superUserShortName) throws IOException {
|
||||||
ArrayList<String> ipList = new ArrayList<String>();
|
ArrayList<String> ipList = new ArrayList<String>();
|
||||||
Enumeration<NetworkInterface> netInterfaceList = NetworkInterface
|
Enumeration<NetworkInterface> netInterfaceList = NetworkInterface
|
||||||
|
@ -102,8 +104,8 @@ public class TestDelegationTokenForProxyUser {
|
||||||
builder.toString());
|
builder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeClass
|
||||||
public void setUp() throws Exception {
|
public static void setUp() throws Exception {
|
||||||
config = new HdfsConfiguration();
|
config = new HdfsConfiguration();
|
||||||
config.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
|
config.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
|
||||||
config.setLong(
|
config.setLong(
|
||||||
|
@ -119,21 +121,20 @@ public class TestDelegationTokenForProxyUser {
|
||||||
cluster = new MiniDFSCluster.Builder(config).build();
|
cluster = new MiniDFSCluster.Builder(config).build();
|
||||||
cluster.waitActive();
|
cluster.waitActive();
|
||||||
ProxyUsers.refreshSuperUserGroupsConfiguration(config);
|
ProxyUsers.refreshSuperUserGroupsConfiguration(config);
|
||||||
|
ugi = UserGroupInformation.createRemoteUser(REAL_USER);
|
||||||
|
proxyUgi = UserGroupInformation.createProxyUserForTesting(PROXY_USER, ugi,
|
||||||
|
GROUP_NAMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterClass
|
||||||
public void tearDown() throws Exception {
|
public static void tearDown() throws Exception {
|
||||||
if(cluster!=null) {
|
if(cluster!=null) {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=20000)
|
||||||
public void testDelegationTokenWithRealUser() throws IOException {
|
public void testDelegationTokenWithRealUser() throws IOException {
|
||||||
UserGroupInformation ugi = UserGroupInformation
|
|
||||||
.createRemoteUser(REAL_USER);
|
|
||||||
final UserGroupInformation proxyUgi = UserGroupInformation
|
|
||||||
.createProxyUserForTesting(PROXY_USER, ugi, GROUP_NAMES);
|
|
||||||
try {
|
try {
|
||||||
Token<?>[] tokens = proxyUgi
|
Token<?>[] tokens = proxyUgi
|
||||||
.doAs(new PrivilegedExceptionAction<Token<?>[]>() {
|
.doAs(new PrivilegedExceptionAction<Token<?>[]>() {
|
||||||
|
@ -154,12 +155,11 @@ public class TestDelegationTokenForProxyUser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(timeout=20000)
|
||||||
public void testWebHdfsDoAs() throws Exception {
|
public void testWebHdfsDoAs() throws Exception {
|
||||||
WebHdfsTestUtil.LOG.info("START: testWebHdfsDoAs()");
|
WebHdfsTestUtil.LOG.info("START: testWebHdfsDoAs()");
|
||||||
((Log4JLogger)NamenodeWebHdfsMethods.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)NamenodeWebHdfsMethods.LOG).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)ExceptionHandler.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)ExceptionHandler.LOG).getLogger().setLevel(Level.ALL);
|
||||||
final UserGroupInformation ugi = UserGroupInformation.createRemoteUser(REAL_USER);
|
|
||||||
WebHdfsTestUtil.LOG.info("ugi.getShortUserName()=" + ugi.getShortUserName());
|
WebHdfsTestUtil.LOG.info("ugi.getShortUserName()=" + ugi.getShortUserName());
|
||||||
final WebHdfsFileSystem webhdfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(ugi, config);
|
final WebHdfsFileSystem webhdfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(ugi, config);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue