HBase
  1. HBase
  2. HBASE-4763

Integrate surefire and junit for category management

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.94.0
    • Fix Version/s: None
    • Component/s: test
    • Labels:
      None

      Description

      As of today, Surefire integrates category on the trunk of 2.11 version: http://jira.codehaus.org/browse/SUREFIRE-329 . It may requires private patches as well.

      It may impact JUnit: https://github.com/KentBeck/junit/issues/359

      This jira is about this integration. We will need a repo for this.

      For the naming of the versions to be created, I don't know if there is a convention. If not I would propose: 2.10-patched-HBASE

      Obviously, it's important to get our changes integrated in the main release: we're not forking surefire & junit!

      1. surefire_hbase.v2.patch
        12 kB
        Nicolas Liochon
      2. surefire_hbase.v3.patch
        11 kB
        Gary Helmling
      3. surefire_793_trunk.v3.patch
        4 kB
        Nicolas Liochon

        Issue Links

          Activity

          Hide
          Nicolas Liochon added a comment -

          Ok, I have it working on my env now. Still testing, but there is now a reasonable chance to have it working well, so we can start the next step. We need a private version for surefire & junit on a shared maven repository.

          • surefire 2.11 trunk r1200541 patched (see attached file)
            Why a private version: because we need the 'Category' feature and there is not yet an official release for it. See surefire issues #329 and #786. We also need to fix some output stuff already in progress at surefire team but not yet in the trunk. I hope this will be solved in 2.12.
            This version would be named: 2.11-TRUNK-HBASE
          • JUnit 4.10 final patched, available on the branch "hbase" at https://github.com/nkeywal/junit
            Why a private version: to filter the tests by categories, JUNit does a 'class.forName' that initializes fully the static. With HBase it costly and fails because the initialization needs specific config files that are not in the initial class loader. The private patch fixes this, and with some luck this patch will be included in the next version of JUnit. See issue #359.
            This version would be named: 4.10-HBASE

          Surefire is integrated with maven, and publishing to a repository should be easy.
          That's not the case with JUnit, the build script does not seem to include a maven repository integration.

          I can make available to the repository owner:

          • for surefire: full maven compiles results (ex: extract of the local repo after a mvn install).
          • for junit: the compiled jar.

          Important point for the categories: what seems to be working is:

          • categories on classes
          • you can set the categories you want to use, excluding categories was not working after #329 (not tried on #786)
          • if you have a class without category, you will have a nice error message: initializationError(org.junit.runner.manipulation.Filter).
          Show
          Nicolas Liochon added a comment - Ok, I have it working on my env now. Still testing, but there is now a reasonable chance to have it working well, so we can start the next step. We need a private version for surefire & junit on a shared maven repository. surefire 2.11 trunk r1200541 patched (see attached file) Why a private version: because we need the 'Category' feature and there is not yet an official release for it. See surefire issues #329 and #786. We also need to fix some output stuff already in progress at surefire team but not yet in the trunk. I hope this will be solved in 2.12. This version would be named: 2.11-TRUNK-HBASE JUnit 4.10 final patched, available on the branch "hbase" at https://github.com/nkeywal/junit Why a private version: to filter the tests by categories, JUNit does a 'class.forName' that initializes fully the static. With HBase it costly and fails because the initialization needs specific config files that are not in the initial class loader. The private patch fixes this, and with some luck this patch will be included in the next version of JUnit. See issue #359. This version would be named: 4.10-HBASE Surefire is integrated with maven, and publishing to a repository should be easy. That's not the case with JUnit, the build script does not seem to include a maven repository integration. I can make available to the repository owner: for surefire: full maven compiles results (ex: extract of the local repo after a mvn install). for junit: the compiled jar. Important point for the categories: what seems to be working is: categories on classes you can set the categories you want to use, excluding categories was not working after #329 (not tried on #786) if you have a class without category, you will have a nice error message: initializationError(org.junit.runner.manipulation.Filter).
          Hide
          Nicolas Liochon added a comment -

          Note that:I found a new bug in surefire, and fixed it. It's SUREFIRE-791 (Unit47 provider reports incorrect elapsed time on test failure.). It should be on their trunk soon, so it makes sense to take it, as they fixed as well a regression of the 2.10, SUREFIRE-785, (Lots of newlines being strewn about in test output). Not mandatory, but nicer.

          Show
          Nicolas Liochon added a comment - Note that:I found a new bug in surefire, and fixed it. It's SUREFIRE-791 (Unit47 provider reports incorrect elapsed time on test failure.). It should be on their trunk soon, so it makes sense to take it, as they fixed as well a regression of the 2.10, SUREFIRE-785, (Lots of newlines being strewn about in test output). Not mandatory, but nicer.
          Hide
          Nicolas Liochon added a comment -

          Surefire revision for SUREFIRE-791 & SUREFIRE-785: r1202059

          Show
          Nicolas Liochon added a comment - Surefire revision for SUREFIRE-791 & SUREFIRE-785: r1202059
          Hide
          stack added a comment -

          You want to give us plugins to host N? Seems like Gary is volunteering hosting .

          Show
          stack added a comment - You want to give us plugins to host N? Seems like Gary is volunteering hosting .
          Hide
          Nicolas Liochon added a comment -

          Yes, I am working with him, he's building surefire & junit today.

          Show
          Nicolas Liochon added a comment - Yes, I am working with him, he's building surefire & junit today.
          Hide
          Gary Helmling added a comment -

          Tweaks to surefire patch changing version number to 2.11-TRUNK-HBASE-1, and removing already applied change.

          Show
          Gary Helmling added a comment - Tweaks to surefire patch changing version number to 2.11-TRUNK- HBASE-1 , and removing already applied change.
          Hide
          Gary Helmling added a comment -

          You should be able to use my repo builds now, by adding the following repository to the HBase pom.xml:

             <repository>
               <id>ghelmling.testing</id>
               <name>Gary Helmling test repo</name>
               <url>http://people.apache.org/~garyh/mvn/</url>
               <snapshots>
                 <enabled>true</enabled>
               </snapshots>
               <releases>
                 <enabled>true</enabled>
               </releases>
             </repository>
          

          Then change the junit and maven-surefire versions to be:
          junit: 4.10-HBASE-1
          surefire: 2.11-TRUNK-HBASE-1

          Show
          Gary Helmling added a comment - You should be able to use my repo builds now, by adding the following repository to the HBase pom.xml: <repository> <id>ghelmling.testing</id> <name>Gary Helmling test repo</name> <url>http: //people.apache.org/~garyh/mvn/</url> <snapshots> <enabled> true </enabled> </snapshots> <releases> <enabled> true </enabled> </releases> </repository> Then change the junit and maven-surefire versions to be: junit: 4.10-HBASE-1 surefire: 2.11-TRUNK-HBASE-1
          Hide
          Nicolas Liochon added a comment -

          We're going to need SUREFIRE-793 (JUnit47 provider reports incorrect time in the XML report). I've got a very dirty patch with many many modifications, I need to spend some time on it to clean it as much as possible (it won't be very clean however).

          Show
          Nicolas Liochon added a comment - We're going to need SUREFIRE-793 (JUnit47 provider reports incorrect time in the XML report). I've got a very dirty patch with many many modifications, I need to spend some time on it to clean it as much as possible (it won't be very clean however).
          Hide
          Nicolas Liochon added a comment -

          Fix for surefire 793. I've been able to reduce the changes to a minimum. Tested on a full build, seems to run fine. I push it on they jira as well, but it will require some changes to manage some cases we don't care about and to be more integrated in their design, so we should not wait for the trunk here.

          Show
          Nicolas Liochon added a comment - Fix for surefire 793. I've been able to reduce the changes to a minimum. Tested on a full build, seems to run fine. I push it on they jira as well, but it will require some changes to manage some cases we don't care about and to be more integrated in their design, so we should not wait for the trunk here.
          Hide
          stack added a comment -

          @nkeywal The attached patch needs to be applied to current surefire trunk, built, and then uploaded to Gary's repo on apache?

          Show
          stack added a comment - @nkeywal The attached patch needs to be applied to current surefire trunk, built, and then uploaded to Gary's repo on apache?
          Hide
          Nicolas Liochon added a comment -

          @stack: yes, but Gary has actually created a special repo for surefire and built it from this.

          Now we have:
          Junit: 4.10-HBASE-1, source code on https://github.com/nkeywal/junit, branch "hbase"
          Surefire: 2.11-TRUNK-HBASE-2, source code on https://github.com/ghelmling/maven-surefire branch "2.11-TRUNK-HBASE"

          Both are in Gary's repo on http://people.apache.org/~garyh/mvn.

          In HBASE-4781, I am currently checking that it works well with Jenkins, if yes:

          • the patch on pom.xml in HBASE-4781 will be commited.
          • we will be able to close the two Jiras.
          Show
          Nicolas Liochon added a comment - @stack: yes, but Gary has actually created a special repo for surefire and built it from this. Now we have: Junit: 4.10- HBASE-1 , source code on https://github.com/nkeywal/junit , branch "hbase" Surefire: 2.11-TRUNK- HBASE-2 , source code on https://github.com/ghelmling/maven-surefire branch "2.11-TRUNK-HBASE" Both are in Gary's repo on http://people.apache.org/~garyh/mvn . In HBASE-4781 , I am currently checking that it works well with Jenkins, if yes: the patch on pom.xml in HBASE-4781 will be commited. we will be able to close the two Jiras.
          Hide
          Nicolas Liochon added a comment -

          I believe the integration is successful, we now have to wait for the fix to be available in official versions, but we can close this JIRA. We will need new JIRA to integrate the official versions. We will need:

          JUnit. Could be for JUnit 4.11. Issue to monitor:
          https://github.com/KentBeck/junit/issues/359: fixed in our version, no feedback for an integration on trunk

          Surefire: Could be for Surefire 2.11. Issues to monitor are:
          329 (category support): fixed, we use the official implementation from the trunk
          786 (@Category with forkMode=always): fixed, we use the official implementation from the trunk
          791 (incorrect elapsed time on test failure): fixed, we use the official implementation from the trunk
          793 (incorrect time in the XML report): fixed on trunk, our fix is different. Trunk should be ok.
          760 (does not take into account the test method): fixed in trunk, not fixed in our version
          798 (print immediately the test class name): not fixed in trunk, not fixed in our version
          799 (Allow test parallelization when forkMode=always): not fixed in trunk, not fixed in our version
          800 (redirectTestOutputToFile not taken into account): not yet fix on trunk, fixed on our version

          800 is the more important to monitor, it's the only one that is fixed in our version but not on trunk.

          Show
          Nicolas Liochon added a comment - I believe the integration is successful, we now have to wait for the fix to be available in official versions, but we can close this JIRA. We will need new JIRA to integrate the official versions. We will need: JUnit. Could be for JUnit 4.11. Issue to monitor: https://github.com/KentBeck/junit/issues/359: fixed in our version, no feedback for an integration on trunk Surefire: Could be for Surefire 2.11. Issues to monitor are: 329 (category support): fixed, we use the official implementation from the trunk 786 (@Category with forkMode=always): fixed, we use the official implementation from the trunk 791 (incorrect elapsed time on test failure): fixed, we use the official implementation from the trunk 793 (incorrect time in the XML report): fixed on trunk, our fix is different. Trunk should be ok. 760 (does not take into account the test method): fixed in trunk, not fixed in our version 798 (print immediately the test class name): not fixed in trunk, not fixed in our version 799 (Allow test parallelization when forkMode=always): not fixed in trunk, not fixed in our version 800 (redirectTestOutputToFile not taken into account): not yet fix on trunk, fixed on our version 800 is the more important to monitor, it's the only one that is fixed in our version but not on trunk.

            People

            • Assignee:
              Nicolas Liochon
              Reporter:
              Nicolas Liochon
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development