[ 
https://issues.apache.org/jira/browse/HDFS-9888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15176311#comment-15176311
 ] 

Xiao Chen commented on HDFS-9888:
---------------------------------

Step 2 in the description is 
[here|https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosName.java#L86]
{code:java}
  static {
    try {
      defaultRealm = KerberosUtil.getDefaultRealm();
    } catch (Exception ke) {
        LOG.debug("Kerberos krb5 configuration not found, setting default realm 
to empty");
        defaultRealm="";
    }
  }
{code}
So patch 1 adds a test-only method to reset the static var {{defaultRealm}}. 
Also broadened the try-finally block in 
{{TestBalancer#testBalancerWithKeytabs}} - currently the try is late.

[~zhz], could you help review? I've verified the patch in the local env in a 
fail-before, pass-after manner. Thanks!

> TestBalancer#testBalancerWithKeytabs should reset KerberosName in test case 
> setup
> ---------------------------------------------------------------------------------
>
>                 Key: HDFS-9888
>                 URL: https://issues.apache.org/jira/browse/HDFS-9888
>             Project: Hadoop HDFS
>          Issue Type: Test
>            Reporter: Xiao Chen
>            Assignee: Xiao Chen
>            Priority: Minor
>         Attachments: HDFS-9888.01.patch
>
>
> In some local environments, {{TestBalancer#testBalancerWithKeytabs}} may 
> fail. Specifically, running itself passes, but running {{TestBalancer}} suite 
> always fail. This is due to:
> # Kerberos setup is done at the test case setup
> # static variable {{KerberosName#defaultRealm}} is set when class 
> initialization - before {{testBalancerWithKeytabs}} setup
> # local default realm is different than test case default realm
> This is mostly an environment specific problem, but let's not make such 
> assumption in the test.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to