This is an automated email from the ASF dual-hosted git repository.

eyang pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 7945ed4  HADOOP-16361. Fixed TestSecureLogins#testValidKerberosName on 
branch-2.               Contributed by Jim Brennan via eyang
7945ed4 is described below

commit 7945ed40f0596da2aedd29f831e8671ba4ea0aa2
Author: Eric Yang <ey...@apache.org>
AuthorDate: Thu Apr 16 12:12:21 2020 -0400

    HADOOP-16361. Fixed TestSecureLogins#testValidKerberosName on branch-2.
                  Contributed by Jim Brennan via eyang
---
 .../org/apache/hadoop/registry/secure/TestSecureLogins.java  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureLogins.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureLogins.java
index 5592e19..5150aac 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureLogins.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/secure/TestSecureLogins.java
@@ -31,6 +31,7 @@ import 
org.apache.hadoop.registry.client.impl.zk.RegistrySecurity;
 import org.apache.hadoop.registry.client.impl.zk.ZookeeperConfigOptions;
 import org.apache.zookeeper.Environment;
 import org.apache.zookeeper.data.ACL;
+import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -179,10 +180,15 @@ public class TestSecureLogins extends 
AbstractSecureRegistryTest {
   public void testValidKerberosName() throws Throwable {
 
     new HadoopKerberosName(ZOOKEEPER).getShortName();
-    new HadoopKerberosName(ZOOKEEPER_LOCALHOST).getShortName();
     new HadoopKerberosName(ZOOKEEPER_REALM).getShortName();
-    // standard rules don't pick this up
-    // new HadoopKerberosName(ZOOKEEPER_LOCALHOST_REALM).getShortName();
+    new HadoopKerberosName(ZOOKEEPER_LOCALHOST_REALM).getShortName();
+    try {
+      new HadoopKerberosName(ZOOKEEPER_LOCALHOST).getShortName();
+      Assert.fail("Unexpected success for invalid principal: " +
+          ZOOKEEPER_LOCALHOST);
+    } catch (IOException e) {
+      LOG.info("Expected exception: " + e.getMessage());
+    }
   }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to