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

Hadoop QA commented on OOZIE-49:
--------------------------------

aprabhakar remarked:
Here is the updated patch:


    diff --git core/src/test/java/org/apache/oozie/test/XTestCase.java 
core/src/test/java/org/apache/oozie/test/XTestCase.java
    index 014e581..b9d8f8e 100644
    --- core/src/test/java/org/apache/oozie/test/XTestCase.java
    +++ core/src/test/java/org/apache/oozie/test/XTestCase.java
    @@ -93,6 +93,36 @@ public abstract class XTestCase extends TestCase {
          */
         public static final String HADOOP_VERSION = "hadoop.version";
     
    +    /** 
    +     * System property that specifies the user that test oozie instance 
runs as.
    +     * The value of this property defaults to the "${user.name} system 
property.
    +     */
    +    public static final String TEST_OOZIE_USER_PROP = 
"oozie.test.user.oozie";
    +
    +    /**
    +     * System property that specifies the default test user name used by 
    +     * the tests. The defalt value of this property is <tt>test</tt>.
    +     */
    +    public static final String TEST_USER1_PROP = "oozie.test.user.test";
    +
    +    /**
    +     * System property that specifies an auxilliary test user name used by 
the 
    +     * tests. The default value of this property is <tt>test2</tt>.
    +     */
    +    public static final String TEST_USER2_PROP = "oozie.test.user.test2";
    +
    +    /**
    +     * System property that specifies another auxilliary test user name 
used by
    +     * the tests. The default value of this property is <tt>test3</tt>.
    +     */
    +    public static final String TEST_USER3_PROP = "oozie.test.user.test3";
    +
    +    /**
    +     * System property that specifies the test groiup used by the tests.
    +     * The default value of this property is <tt>testg</tt>.
    +     */
    +    public static final String TEST_GROUP_PROP = "oozie.test.group";
    +
         /**
          * Initialize the test working directory. <p/> If it does not exist it 
creates it, if it already exists it deletes
          * all its contents. <p/> The test working directory it is not deleted 
after the test runs. <p/>
    @@ -152,25 +182,39 @@ public abstract class XTestCase extends TestCase {
             return hadoopVersion;
         }
     
    +    public static String getOozieUser() {
    +        return System.getProperty(TEST_OOZIE_USER_PROP, 
    +            System.getProperty("user.name"));
    +    }
    +
    +    /**
    +     * @return the user to use in testcases.
    +     */
         protected String getTestUser() {
    -        return "test";
    +        return System.getProperty(TEST_USER1_PROP, "test");
         }
     
    +    /**
    +     * @return the user to use in testcases.
    +     */
         protected String getTestUser2() {
    -        return "test2";
    +        return System.getProperty(TEST_USER2_PROP, "test2");
         }
     
    +    /**
    +     * @return the user to use in testcases.
    +     */
         protected String getTestUser3() {
    -        return "test3";
    +        return System.getProperty(TEST_USER3_PROP, "test3");
         }
     
         /**
    -     * Return the user to use in testcases.
    +     * Return the user group to use in testcases.
          *
    -     * @return the user to use in testcases.
    +     * @return the user group to use in testcases.
          */
         protected String getTestGroup() {
    -        return "testg";
    +        return System.getProperty(TEST_GROUP_PROP, "testg");
         }
     
         /**
    @@ -356,7 +400,7 @@ public abstract class XTestCase extends TestCase {
     
         public String getOoziePrincipal() {
             return System.getProperty("oozie.test.kerberos.oozie.principal",
    -                                  System.getProperty("user.name") + 
"/localhost") + "@" + getRealm();
    +                                  getOozieUser() + "/localhost") + "@" + 
getRealm();
         }
     
         public String getJobTrackerPrincipal() {
    @@ -500,12 +544,13 @@ public abstract class XTestCase extends TestCase {
                 }
                 int taskTrackers = 2;
                 int dataNodes = 2;
    +            String oozieUser = getOozieUser();
                 JobConf conf = new JobConf();
                 conf.set("dfs.block.access.token.enable", "false");
                 conf.set("dfs.permissions", "true");
                 conf.set("hadoop.security.authentication", "simple");
    -            conf.set("hadoop.proxyuser." + System.getProperty("user.name") 
+ ".hosts", "localhost");
    -            conf.set("hadoop.proxyuser." + System.getProperty("user.name") 
+ ".groups", "users");
    +            conf.set("hadoop.proxyuser." + oozieUser + ".hosts", 
"localhost");
    +            conf.set("hadoop.proxyuser." + oozieUser + ".groups", "users");
                 conf.set("mapred.tasktracker.map.tasks.maximum", "4");
                 conf.set("mapred.tasktracker.reduce.tasks.maximum", "4");
                 dfsCluster = new MiniDFSCluster(conf, dataNodes, true, null);
    diff --git pom.xml pom.xml
    index 75d70c8..99fcc8c 100644
    --- pom.xml
    +++ pom.xml
    @@ -58,6 +58,11 @@
             
<oozie.test.kerberos.oozie.principal>${user.name}/localhost</oozie.test.kerberos.oozie.principal>
             
<oozie.test.kerberos.jobtracker.principal>mapred/localhost</oozie.test.kerberos.jobtracker.principal>
             
<oozie.test.kerberos.namenode.principal>hdfs/localhost</oozie.test.kerberos.namenode.principal>
    +        <oozie.test.user.oozie>${user.name}</oozie.test.user.oozie>
    +        <oozie.test.user.test>test</oozie.test.user.test>
    +        <oozie.test.user.test2>test2</oozie.test.user.test2>
    +        <oozie.test.user.test3>test3</oozie.test.user.test3>
    +        <oozie.test.group>testg</oozie.test.group>
         </properties>
     
         <licenses>
    @@ -219,6 +224,26 @@
                         <argLine>-Xmx512m</argLine>
                         <systemProperties>
                             <property>
    +                            <name>oozie.test.user.oozie</name>
    +                            <value>${oozie.test.user.oozie}</value>
    +                        </property>
    +                        <property>
    +                            <name>oozie.test.user.test</name>
    +                            <value>${oozie.test.user.test}</value>
    +                        </property>
    +                        <property>
    +                            <name>oozie.test.user.test2</name>
    +                            <value>${oozie.test.user.test2}</value>
    +                        </property>
    +                        <property>
    +                            <name>oozie.test.user.test3</name>
    +                            <value>${oozie.test.user.test3}</value>
    +                        </property>
    +                        <property>
    +                            <name>oozie.test.group</name>
    +                            <value>${oozie.test.group}</value>
    +                        </property>
    +                        <property>
                                 <name>oozie.test.dir</name>
                                 <value>${oozie.test.dir}</value>
                             </property>


I removed the `getSystemProperty()` method altogether as it was not serving any 
purpose anymore.

> GH-3: The XTestCase.getTestUser() method returns the hardcoded username test. 
> This results in failure due to SSH authentication failure in case this user 
> is not setup correctly.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OOZIE-49
>                 URL: https://issues.apache.org/jira/browse/OOZIE-49
>             Project: Oozie
>          Issue Type: Bug
>            Reporter: Hadoop QA
>
> One workaround would be to run the tests as test user and have the 
> environment setup correctly for that. The other solution would be to by 
> default use the current user for test purposes, and overwrite that to another 
> user where necessary.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to