|
@@ -93,6 +93,7 @@ import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
|
|
import org.apache.hadoop.http.HttpConfig;
|
|
|
import org.apache.hadoop.io.IOUtils;
|
|
|
import org.apache.hadoop.minikdc.MiniKdc;
|
|
|
+import org.apache.hadoop.security.authentication.util.KerberosName;
|
|
|
import org.apache.hadoop.security.SecurityUtil;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
|
|
@@ -139,6 +140,7 @@ public class TestBalancer {
|
|
|
SecurityUtil.setAuthenticationMethod(
|
|
|
UserGroupInformation.AuthenticationMethod.KERBEROS, conf);
|
|
|
UserGroupInformation.setConfiguration(conf);
|
|
|
+ KerberosName.resetDefaultRealm();
|
|
|
assertTrue("Expected configuration to enable security",
|
|
|
UserGroupInformation.isSecurityEnabled());
|
|
|
|
|
@@ -270,7 +272,7 @@ public class TestBalancer {
|
|
|
long[] usedSpace = new long[distribution.length];
|
|
|
System.arraycopy(distribution, 0, usedSpace, 0, distribution.length);
|
|
|
|
|
|
- List<List<Block>> blockReports =
|
|
|
+ List<List<Block>> blockReports =
|
|
|
new ArrayList<List<Block>>(usedSpace.length);
|
|
|
Block[][] results = new Block[usedSpace.length][];
|
|
|
for(int i=0; i<usedSpace.length; i++) {
|
|
@@ -327,7 +329,7 @@ public class TestBalancer {
|
|
|
blocks, (short)(numDatanodes-1), distribution);
|
|
|
|
|
|
// restart the cluster: do NOT format the cluster
|
|
|
- conf.set(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY, "0.0f");
|
|
|
+ conf.set(DFSConfigKeys.DFS_NAMENODE_SAFEMODE_THRESHOLD_PCT_KEY, "0.0f");
|
|
|
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(numDatanodes)
|
|
|
.format(false)
|
|
|
.racks(racks)
|
|
@@ -1556,10 +1558,10 @@ public class TestBalancer {
|
|
|
@Test(timeout = 300000)
|
|
|
public void testBalancerWithKeytabs() throws Exception {
|
|
|
final Configuration conf = new HdfsConfiguration();
|
|
|
- initSecureConf(conf);
|
|
|
- final UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(
|
|
|
- principal, keytabFile.getAbsolutePath());
|
|
|
try {
|
|
|
+ initSecureConf(conf);
|
|
|
+ final UserGroupInformation ugi = UserGroupInformation.loginUserFromKeytabAndReturnUGI(
|
|
|
+ principal, keytabFile.getAbsolutePath());
|
|
|
ugi.doAs(new PrivilegedExceptionAction<Void>() {
|
|
|
@Override
|
|
|
public Void run() throws Exception {
|