YARN-5208. Run TestAMRMClient TestNMClient TestYarnClient TestClientRMTokens TestAMAuthorization tests with hadoop.security.token.service.use_ip enabled. (Rohith Sharma K S via wangda)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/244506f9 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/244506f9 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/244506f9 Branch: refs/heads/HDFS-7240 Commit: 244506f9c8953029283aa8e0eb2006ae2f30025e Parents: d44f474 Author: Wangda Tan <wan...@apache.org> Authored: Fri Jun 10 09:34:32 2016 -0700 Committer: Wangda Tan <wan...@apache.org> Committed: Fri Jun 10 09:34:32 2016 -0700 ---------------------------------------------------------------------- .../api/impl/TestAMRMClientOnRMRestart.java | 16 +++++++++++-- .../src/test/resources/core-site.xml | 25 -------------------- .../resourcemanager/TestAMAuthorization.java | 22 +++++++++++++++++ .../resourcemanager/TestClientRMTokens.java | 22 +++++++++++++++++ 4 files changed, 58 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/244506f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientOnRMRestart.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientOnRMRestart.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientOnRMRestart.java index 0890396..719d9a1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientOnRMRestart.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestAMRMClientOnRMRestart.java @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.net.NetworkTopology; import org.apache.hadoop.net.ServerSocketUtil; import org.apache.hadoop.security.SecurityUtil; @@ -70,18 +71,22 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEv import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler; import org.apache.hadoop.yarn.server.resourcemanager.security.AMRMTokenSecretManager; import org.apache.hadoop.yarn.util.Records; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; public class TestAMRMClientOnRMRestart { - static Configuration conf = null; + static Configuration conf = new Configuration(); static final int rolling_interval_sec = 13; static final long am_expire_ms = 4000; @BeforeClass public static void setup() throws Exception { - conf = new Configuration(); + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, false); + SecurityUtil.setConfiguration(conf); + conf.set(YarnConfiguration.RECOVERY_ENABLED, "true"); conf.set(YarnConfiguration.RM_STORE, MemoryRMStateStore.class.getName()); conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, @@ -90,6 +95,13 @@ public class TestAMRMClientOnRMRestart { conf.setLong(YarnConfiguration.RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS, 0); } + @AfterClass + public static void tearDown() { + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, true); + SecurityUtil.setConfiguration(conf); + } + // Test does major 6 steps verification. // Step-1 : AMRMClient send allocate request for 3 container requests // Step-2 : 3 containers are allocated by RM. http://git-wip-us.apache.org/repos/asf/hadoop/blob/244506f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/resources/core-site.xml ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/resources/core-site.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/resources/core-site.xml deleted file mode 100644 index f0d3085..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/resources/core-site.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> -<!-- - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. See accompanying LICENSE file. ---> - -<!-- Put site-specific property overrides in this file. --> - -<configuration> - <property> - <name>hadoop.security.token.service.use_ip</name> - <value>false</value> - </property> - -</configuration> http://git-wip-us.apache.org/repos/asf/hadoop/blob/244506f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java index c51cd87..0f88c79 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestAMAuthorization.java @@ -30,6 +30,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.io.DataInputByteBuffer; import org.apache.hadoop.security.AccessControlException; @@ -63,7 +64,9 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.util.Records; import org.junit.After; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -77,6 +80,25 @@ public class TestAMAuthorization { private final Configuration conf; private MockRM rm; + // Note : Any test case in ResourceManager package that creates a proxy has + // to be run with enabling hadoop.security.token.service.use_ip. And reset + // to false at the end of test class. See YARN-5208 + @BeforeClass + public static void setUp() { + Configuration conf = new Configuration(); + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, true); + SecurityUtil.setConfiguration(conf); + } + + @AfterClass + public static void resetConf() { + Configuration conf = new Configuration(); + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, false); + SecurityUtil.setConfiguration(conf); + } + @Parameters public static Collection<Object[]> configs() { Configuration conf = new Configuration(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/244506f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java index c21db4e..65145a4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java @@ -37,11 +37,13 @@ import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; import org.apache.hadoop.net.NetUtils; +import org.junit.AfterClass; import org.junit.Assert; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeys; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.Text; @@ -72,6 +74,7 @@ import org.apache.hadoop.yarn.server.utils.BuilderUtils; import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.util.Records; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; @@ -79,6 +82,25 @@ public class TestClientRMTokens { private static final Log LOG = LogFactory.getLog(TestClientRMTokens.class); + // Note : Any test case in ResourceManager package that creates a proxy has + // to be run with enabling hadoop.security.token.service.use_ip. And reset + // to false at the end of test class. See YARN-5208 + @BeforeClass + public static void setUp() { + Configuration conf = new Configuration(); + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, true); + SecurityUtil.setConfiguration(conf); + } + + @AfterClass + public static void tearDown() { + Configuration conf = new Configuration(); + conf.setBoolean( + CommonConfigurationKeys.HADOOP_SECURITY_TOKEN_SERVICE_USE_IP, false); + SecurityUtil.setConfiguration(conf); + } + @Before public void resetSecretManager() { RMDelegationTokenIdentifier.Renewer.setSecretManager(null, null); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org