Hadoop Common
  1. Hadoop Common
  2. HADOOP-2775

[HOD] Put in place unit test framework for HOD

    Details

    • Type: Test Test
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.16.0
    • Fix Version/s: 0.17.0
    • Component/s: contrib/hod
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      A unit testing framework based on pyunit is added to HOD. Developers contributing patches to HOD should now contribute unit tests along with the patches where possible.

      Description

      HOD does not have any unit tests in place currently. This issue is to decide on a framework that would be effective for our python code base. Something on the lines of pyUnit would be good. The fix should put in place any dependencies needed for running the tests, and should also define some tests that demonstrate how to write further tests. We would not be defining a complete unit test suite for the entire code base right now, but would incrementatlly add tests as changes are made.

      1. HADOOP-2775.1
        19 kB
        Vinod Kumar Vavilapalli
      2. patch_unittesting
        10 kB
        Vinod Kumar Vavilapalli
      3. patch_unittesting.1
        13 kB
        Vinod Kumar Vavilapalli
      4. patch_unittesting.2
        17 kB
        Vinod Kumar Vavilapalli
      5. patch_unittesting.3
        17 kB
        Vinod Kumar Vavilapalli
      6. patch_unittesting.4
        19 kB
        Vinod Kumar Vavilapalli
      7. patch_unittesting.5
        19 kB
        Vinod Kumar Vavilapalli

        Activity

        Hide
        Vinod Kumar Vavilapalli added a comment -

        Adding unitest framework using Pyunit. Added an example hodlig/Testing/testModule.py which can be used as a template. -ant test- would now run hod tests too.

        Need Python 2.5.1 to be installed on Hudson.

        Show
        Vinod Kumar Vavilapalli added a comment - Adding unitest framework using Pyunit. Added an example hodlig/Testing/testModule.py which can be used as a template. - ant test - would now run hod tests too. Need Python 2.5.1 to be installed on Hudson.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        oh.. forgot the license. Will submit again tomorrow. Need revision of everything else barring that.

        Show
        Vinod Kumar Vavilapalli added a comment - oh.. forgot the license. Will submit again tomorrow. Need revision of everything else barring that.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Reattaching. Including license headers in each file.

        Show
        Vinod Kumar Vavilapalli added a comment - Reattaching. Including license headers in each file.
        Hide
        Hemanth Yamijala added a comment -

        Some comments:

        • Let's move the tests under hod directly instead of under hod/hodlib.
        • The 'main' module is not being properly excluded as expected. By the same argument, any file which does not begin with test will not be excluded. I think we should worry about excluding only test modules, where test modules, by our convention, start with 'test'
        • The code in the test module's runTests is repeated. We should explore pulling it out into a common place, like a base class.
        • I am not sure we should have tests beginning with test. Can't we just have them begin with test_ ?
        • The output from the tests, when run through 'ant test', is in the wrong order. We can either remove our outputs, or put them in the right order.
        Show
        Hemanth Yamijala added a comment - Some comments: Let's move the tests under hod directly instead of under hod/hodlib. The 'main' module is not being properly excluded as expected. By the same argument, any file which does not begin with test will not be excluded. I think we should worry about excluding only test modules, where test modules, by our convention, start with 'test' The code in the test module's runTests is repeated. We should explore pulling it out into a common place, like a base class. I am not sure we should have tests beginning with test . Can't we just have them begin with test_ ? The output from the tests, when run through 'ant test', is in the wrong order. We can either remove our outputs, or put them in the right order.
        Hide
        Vinod Kumar Vavilapalli added a comment -
        • moved the tests to hod/Testing. Changed build.xml to reflect this too.
        • 'excludes' now handles only modules starting with 'test'. Files not starting with 'test' like main.py, _init_.py are automatically excluded.
        • Refactored code from each module's ModuleTestSuite class to a base class BaseTestSuite in Testing/lib.py. Changed how we pick up names of testclasses also.
        • All the test classes now begin with test_ (and not test). Changed SuiteCallers method from testModule() to RunModuleTests() so that it doesn't clash with name convention of test classes.
        • Output from the tests is fixed now to be in correct order.
        • Earlier failure of some test module due to say syntax errors kills the whole test process. It's handled now to continue despite errors in some test modules.
        • Made test target depend on compile target, so that ant test can be directly run after making changes
        Show
        Vinod Kumar Vavilapalli added a comment - moved the tests to hod/Testing. Changed build.xml to reflect this too. 'excludes' now handles only modules starting with 'test'. Files not starting with 'test' like main.py, _ init _.py are automatically excluded. Refactored code from each module's ModuleTestSuite class to a base class BaseTestSuite in Testing/lib.py. Changed how we pick up names of testclasses also. All the test classes now begin with test_ (and not test ). Changed SuiteCallers method from testModule() to RunModuleTests() so that it doesn't clash with name convention of test classes. Output from the tests is fixed now to be in correct order. Earlier failure of some test module due to say syntax errors kills the whole test process. It's handled now to continue despite errors in some test modules. Made test target depend on compile target, so that ant test can be directly run after making changes
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Changing ant build.xml to detect python through a -Dpython.home option instead of checking system's $PATH through `which python`. As for version, currently checking only for Python 2.5.1.

        Show
        Vinod Kumar Vavilapalli added a comment - Changing ant build.xml to detect python through a -Dpython.home option instead of checking system's $PATH through `which python`. As for version, currently checking only for Python 2.5.1.
        Hide
        Hemanth Yamijala added a comment -

        Looks good now.. Few more comments:

        • Failing test cases should fail the ant test task
        • Currently, contrib test target would fail if a required python version is not specified or available. This would be inconvenient for users not interested in running HOD unit tests, but would like to fire a test build at the contrib level. We could simply ignore running the tests if the required python is not found. However, that has a side-effect of hiding misconfigured python on Hudson. Given that the latter would be rare, and is a one time setup, I would still go with that approach. Comments ?
        • At a suite level only tearDown is defined, but not setUp.
        • Can we make the directory 'test' rather than 'Testing' - just a more conventional name.
        Show
        Hemanth Yamijala added a comment - Looks good now.. Few more comments: Failing test cases should fail the ant test task Currently, contrib test target would fail if a required python version is not specified or available. This would be inconvenient for users not interested in running HOD unit tests, but would like to fire a test build at the contrib level. We could simply ignore running the tests if the required python is not found. However, that has a side-effect of hiding misconfigured python on Hudson. Given that the latter would be rare, and is a one time setup, I would still go with that approach. Comments ? At a suite level only tearDown is defined, but not setUp. Can we make the directory 'test' rather than 'Testing' - just a more conventional name.
        Hide
        Vinod Kumar Vavilapalli added a comment -
        • Failing test cases now make the build fail. Total number of failures + errors is reported back as return code of run tests.
        • python.home or python version mismatch(currently supporting only 2.5.1) would now make ant test to report silently, but not fail, so that other contrib tests may continue. This execution path is not traced on hudson once python stuff is setup there.
        • At a suite level setUp is done through ModuleTestSuite._init_. No changes here.
        • Moved testcases to src/contrib/hod/test/
        • Fixed some of the testcase reporting to make it look better.
        Show
        Vinod Kumar Vavilapalli added a comment - Failing test cases now make the build fail. Total number of failures + errors is reported back as return code of run tests. python.home or python version mismatch(currently supporting only 2.5.1) would now make ant test to report silently, but not fail, so that other contrib tests may continue. This execution path is not traced on hudson once python stuff is setup there. At a suite level setUp is done through ModuleTestSuite._ init _. No changes here. Moved testcases to src/contrib/hod/test/ Fixed some of the testcase reporting to make it look better.
        Hide
        Vinod Kumar Vavilapalli added a comment -
        • Renaming testing directory to test broke things, python had a built-in test module. Changed name to "testing"
        • Changed ant target names so that they reflect things better. Slightly made changes in the order of calling of targets also.
        Show
        Vinod Kumar Vavilapalli added a comment - Renaming testing directory to test broke things, python had a built-in test module. Changed name to "testing" Changed ant target names so that they reflect things better. Slightly made changes in the order of calling of targets also.
        Hide
        Hemanth Yamijala added a comment -

        +1. Looks good.

        Show
        Hemanth Yamijala added a comment - +1. Looks good.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Submitting the patch.

        Show
        Vinod Kumar Vavilapalli added a comment - Submitting the patch.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12375997/patch_unittesting.5
        against trunk revision 619744.

        @author +1. The patch does not contain any @author tags.

        tests included +1. The patch appears to include 29 new or modified tests.

        javadoc +1. The javadoc tool did not generate any warning messages.

        javac +1. The applied patch does not generate any new javac compiler warnings.

        release audit -1. The applied patch generated 194 release audit warnings (more than the trunk's current 192 warnings).

        findbugs +1. The patch does not introduce any new Findbugs warnings.

        core tests -1. The patch failed core unit tests.

        contrib tests +1. The patch passed contrib unit tests.

        Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/build/test/checkstyle-errors.html
        Release audit warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/current/releaseAuditDiffWarnings.txt
        Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12375997/patch_unittesting.5 against trunk revision 619744. @author +1. The patch does not contain any @author tags. tests included +1. The patch appears to include 29 new or modified tests. javadoc +1. The javadoc tool did not generate any warning messages. javac +1. The applied patch does not generate any new javac compiler warnings. release audit -1. The applied patch generated 194 release audit warnings (more than the trunk's current 192 warnings). findbugs +1. The patch does not introduce any new Findbugs warnings. core tests -1. The patch failed core unit tests. contrib tests +1. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/build/test/checkstyle-errors.html Release audit warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/artifact/trunk/current/releaseAuditDiffWarnings.txt Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1943/console This message is automatically generated.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        The core tests failed are related to DFS and not this patch.

        The patch is committable.

        Show
        Vinod Kumar Vavilapalli added a comment - The core tests failed are related to DFS and not this patch. The patch is committable.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Cancelling to fix the release audit warnings

        Show
        Vinod Kumar Vavilapalli added a comment - Cancelling to fix the release audit warnings
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Reattaching the patch.

        Show
        Vinod Kumar Vavilapalli added a comment - Reattaching the patch.
        Hide
        Vinod Kumar Vavilapalli added a comment -

        Submitting. File HADOOP-2775.1 is the latest patch.

        Show
        Vinod Kumar Vavilapalli added a comment - Submitting. File HADOOP-2775 .1 is the latest patch.
        Hide
        Hadoop QA added a comment -

        +1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12377674/HADOOP-2775.1
        against trunk revision 619744.

        @author +1. The patch does not contain any @author tags.

        tests included +1. The patch appears to include 29 new or modified tests.

        javadoc +1. The javadoc tool did not generate any warning messages.

        javac +1. The applied patch does not generate any new javac compiler warnings.

        release audit +1. The applied patch does not generate any new release audit warnings.

        findbugs +1. The patch does not introduce any new Findbugs warnings.

        core tests +1. The patch passed core unit tests.

        contrib tests +1. The patch passed contrib unit tests.

        Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/artifact/trunk/build/test/checkstyle-errors.html
        Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - +1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12377674/HADOOP-2775.1 against trunk revision 619744. @author +1. The patch does not contain any @author tags. tests included +1. The patch appears to include 29 new or modified tests. javadoc +1. The javadoc tool did not generate any warning messages. javac +1. The applied patch does not generate any new javac compiler warnings. release audit +1. The applied patch does not generate any new release audit warnings. findbugs +1. The patch does not introduce any new Findbugs warnings. core tests +1. The patch passed core unit tests. contrib tests +1. The patch passed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/artifact/trunk/build/test/checkstyle-errors.html Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/1954/console This message is automatically generated.
        Hide
        Devaraj Das added a comment -

        I just committed this. Thanks, Vinod!

        Show
        Devaraj Das added a comment - I just committed this. Thanks, Vinod!
        Hide
        Hudson added a comment -
        Show
        Hudson added a comment - Integrated in Hadoop-trunk #428 (See http://hudson.zones.apache.org/hudson/job/Hadoop-trunk/428/ )

          People

          • Assignee:
            Vinod Kumar Vavilapalli
            Reporter:
            Hemanth Yamijala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development