|
@@ -44,6 +44,7 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY;
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_LAZY_PERSIST_FILE_SCRUB_INTERVAL_SEC;
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_LAZY_PERSIST_FILE_SCRUB_INTERVAL_SEC;
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY;
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY;
|
|
import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
|
|
import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
|
|
|
|
+import org.junit.AfterClass;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.fail;
|
|
import static org.junit.Assert.fail;
|
|
@@ -138,6 +139,8 @@ public class TestBalancer {
|
|
final static private String username = "balancer";
|
|
final static private String username = "balancer";
|
|
private static String principal;
|
|
private static String principal;
|
|
private static File baseDir;
|
|
private static File baseDir;
|
|
|
|
+ private static String keystoresDir;
|
|
|
|
+ private static String sslConfDir;
|
|
private static MiniKdc kdc;
|
|
private static MiniKdc kdc;
|
|
private static File keytabFile;
|
|
private static File keytabFile;
|
|
private MiniDFSCluster cluster;
|
|
private MiniDFSCluster cluster;
|
|
@@ -252,8 +255,8 @@ public class TestBalancer {
|
|
conf.set(DFS_BALANCER_KEYTAB_FILE_KEY, keytab);
|
|
conf.set(DFS_BALANCER_KEYTAB_FILE_KEY, keytab);
|
|
conf.set(DFS_BALANCER_KERBEROS_PRINCIPAL_KEY, principal);
|
|
conf.set(DFS_BALANCER_KERBEROS_PRINCIPAL_KEY, principal);
|
|
|
|
|
|
- String keystoresDir = baseDir.getAbsolutePath();
|
|
|
|
- String sslConfDir = KeyStoreTestUtil.getClasspathDir(TestBalancer.class);
|
|
|
|
|
|
+ keystoresDir = baseDir.getAbsolutePath();
|
|
|
|
+ sslConfDir = KeyStoreTestUtil.getClasspathDir(TestBalancer.class);
|
|
KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
|
|
KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false);
|
|
|
|
|
|
conf.set(DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY,
|
|
conf.set(DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY,
|
|
@@ -263,6 +266,15 @@ public class TestBalancer {
|
|
initConf(conf);
|
|
initConf(conf);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @AfterClass
|
|
|
|
+ public static void destroy() throws Exception {
|
|
|
|
+ if (kdc != null) {
|
|
|
|
+ kdc.stop();
|
|
|
|
+ }
|
|
|
|
+ FileUtil.fullyDelete(baseDir);
|
|
|
|
+ KeyStoreTestUtil.cleanupSSLConfig(keystoresDir, sslConfDir);
|
|
|
|
+ }
|
|
|
|
+
|
|
/* create a file with a length of <code>fileLen</code> */
|
|
/* create a file with a length of <code>fileLen</code> */
|
|
public static void createFile(MiniDFSCluster cluster, Path filePath, long
|
|
public static void createFile(MiniDFSCluster cluster, Path filePath, long
|
|
fileLen,
|
|
fileLen,
|