HADOOP-16361. Fixed TestSecureLogins#testValidKerberosName on branch-2.

Contributed by Jim Brennan via eyang
This commit is contained in:
Eric Yang 2020-04-16 12:12:21 -04:00
parent 0e05b02136
commit 7945ed40f0
1 changed files with 9 additions and 3 deletions

View File

@ -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());
}
}