浏览代码

YARN-10140: TestTimelineAuthFilterForV2 fails due to login failures in branch-2.10. Contributed by Ahmed Hussein (ahussein)

Eric E Payne 5 年之前
父节点
当前提交
254b94bf5e

+ 3 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/timelineservice/security/TestTimelineAuthFilterForV2.java

@@ -52,6 +52,7 @@ import org.apache.hadoop.security.SecurityUtil;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.authentication.KerberosTestUtils;
 import org.apache.hadoop.security.authentication.KerberosTestUtils;
 import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
 import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
+import org.apache.hadoop.security.authentication.util.KerberosName;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.apache.hadoop.security.ssl.KeyStoreTestUtil;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager;
 import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager;
@@ -137,6 +138,8 @@ public class TestTimelineAuthFilterForV2 {
       testMiniKDC.start();
       testMiniKDC.start();
       testMiniKDC.createPrincipal(
       testMiniKDC.createPrincipal(
           httpSpnegoKeytabFile, HTTP_USER + "/localhost");
           httpSpnegoKeytabFile, HTTP_USER + "/localhost");
+      // reset the realm after the testMiniKDC has been created
+      KerberosName.resetDefaultRealm();
     } catch (Exception e) {
     } catch (Exception e) {
       fail("Couldn't setup MiniKDC.");
       fail("Couldn't setup MiniKDC.");
     }
     }