|
@@ -39,7 +39,7 @@ import java.util.Set;
|
|
|
import java.util.TreeSet;
|
|
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
-import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
|
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
|
|
import org.apache.hadoop.io.DataOutputBuffer;
|
|
|
import org.apache.hadoop.io.Text;
|
|
|
import org.apache.hadoop.security.Credentials;
|
|
@@ -133,6 +133,11 @@ public class TestAMRMClient {
|
|
|
// set the minimum allocation so that resource decrease can go under 1024
|
|
|
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 512);
|
|
|
conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
|
|
|
+ createClientAndCluster(conf);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void createClientAndCluster(Configuration conf)
|
|
|
+ throws Exception {
|
|
|
yarnCluster = new MiniYARNCluster(TestAMRMClient.class.getName(), nodeCount, 1, 1);
|
|
|
yarnCluster.init(conf);
|
|
|
yarnCluster.start();
|
|
@@ -656,6 +661,29 @@ public class TestAMRMClient {
|
|
|
|
|
|
@Test (timeout=60000)
|
|
|
public void testAMRMClient() throws YarnException, IOException {
|
|
|
+ registerAndAllocate();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test (timeout=60000)
|
|
|
+ public void testAMRMClientWithSaslEncryption() throws Exception {
|
|
|
+ conf.set(CommonConfigurationKeysPublic.HADOOP_RPC_PROTECTION, "privacy");
|
|
|
+ // we have to create a new instance of MiniYARNCluster to avoid SASL qop
|
|
|
+ // mismatches between client and server
|
|
|
+ tearDown();
|
|
|
+ createClientAndCluster(conf);
|
|
|
+ startApp();
|
|
|
+ registerAndAllocate();
|
|
|
+
|
|
|
+ // recreate the original MiniYARNCluster and YarnClient for other tests
|
|
|
+ conf.unset(CommonConfigurationKeysPublic.HADOOP_RPC_PROTECTION);
|
|
|
+ tearDown();
|
|
|
+ createClientAndCluster(conf);
|
|
|
+ // unless we start an application the cancelApp() method will fail when
|
|
|
+ // it runs after this test
|
|
|
+ startApp();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void registerAndAllocate() throws YarnException, IOException {
|
|
|
AMRMClient<ContainerRequest> amClient = null;
|
|
|
try {
|
|
|
// start am rm client
|