[ 
https://jira.codehaus.org/browse/SUREFIRE-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=323609#comment-323609
 ] 

Nicolas Liochon commented on SUREFIRE-985:
------------------------------------------

The full story is in HBASE-4763 and HBASE-4955, but basically it was just to 
get the features we needed (categorization and parallelization) before they 
were officially integrated in surefire. When I did it, I was not expecting that 
going back to the official version will take more than a year :-). We're close 
now, I think the last issue is  SUREFIRE-969. We also patched JUnit, and as 
they release a version a year we had to wait as well.

If I list my pain points, or what we did, it would be:
 - all this work on categories/parallelisation, it's integrated now.
 - the double path junit4 / junit47: changing some setting was going to a 
totally different behavior in junit, so we discovered new bugs
 - when a process dies or does not terminate, surefire does not always says 
there is an issue nor kill the process. We added some ps | jstack | kill to do 
that (see zombie related stuff in 
https://github.com/apache/hbase/blob/trunk/dev-support/test-patch.sh). 
 - we added a junit listener to add some info on the context. Having the 
workload of the machine, the number of threads, this kind of things, helps when 
the tests don't work as expected.
 - timeouts are difficult to manage. People use test timeout to workaround that 
when surefire kills a process, you don't know what was executed. So they put 
the timeout in the test vs. the global surefire timeout. And then if the build 
machine is too slow your test suite becomes flaky.

                
> Some Parameterized tests are not executed (or not reported)
> -----------------------------------------------------------
>
>                 Key: SUREFIRE-985
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-985
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 2.14
>         Environment: linux, 2 *4 cores, 32 Gb RAM (The sample does not work 
> on Windows)
>            Reporter: Nicolas Liochon
>            Assignee: Andreas Gudian
>            Priority: Critical
>             Fix For: 2.15
>
>
> The test itself does nothing. The problem occurs when you have a lot of test 
> classes with different categories, that's why I haven't been able to extract 
> it (I suppose generating test classes would work): the report 'forgets' some 
> tests.
> here is a branch I created to reproduce the issue:
> {code}
> git clone -b surefire git://github.com/nkeywal/hbase.git
> mvn clean install -D skipTests
> {code}
> There is a lot of third parties and code. Then:
> {code}
> mvn test -pl hbase-server
> {code}
> will give back a random number of test executed (from 0 to 9).
> If you specify the test name with -Dtest= the number of tests is always 9 (as 
> expected).
> Building will take time, but there is a single test to execute.
> It's fragile: I tried to move the test to a difference package and the 
> problem was not reproducable anymore. But I do reproduce it on a clean 
> install with the branch above, and I do reproduce it all the time on our test 
> suite, on different Linux machines.
>  
> test code:
> {code}
> package org.apache.hadoop.hbase.regionserver;
> import java.util.*;
> @org.junit.runner.RunWith(org.junit.runners.Parameterized.class)
> @org.junit.experimental.categories.Category(org.apache.hadoop.hbase.S1Tests.class)
> public class TestSurefire {
>   @org.junit.runners.Parameterized.Parameters
>   public static Collection<Object[]> parameters() {
>     ArrayList<Object[]> configurations = new ArrayList<Object[]>();
>     for (int i = 1; i < 10; i++) {
>       configurations.add(new Object[] { i });
>     }
>     return configurations;
>   }
>   public TestSurefire(Object o) {
>   }
>   @org.junit.Test
>   public void testM()  {
>   }
> }
> {code}
> settings
> {code}
>         <plugin>
>           <artifactId>maven-surefire-plugin</artifactId>
>           <version>2.14</version>
>           <configuration>
>             <reuseForks>true</reuseForks>
>             <forkCount>2</forkCount>
>                 <groups>org.apache.hadoop.hbase.S1Tests</groups>
>             <redirectTestOutputToFile>true</redirectTestOutputToFile>
>           </configuration>
>         </plugin>
> {code}
> Example of output:
> {noformat}
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> parallel='none', perCoreThreadCount=true, threadCount=2, 
> useUnlimitedThreads=false
> parallel='none', perCoreThreadCount=true, threadCount=2, 
> useUnlimitedThreads=false
> Results :
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> {noformat}
> or
> {noformat}
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> parallel='none', perCoreThreadCount=true, threadCount=2, 
> useUnlimitedThreads=false
> parallel='none', perCoreThreadCount=true, threadCount=2, 
> useUnlimitedThreads=false
> Running org.apache.hadoop.hbase.regionserver.TestSurefire
> Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
> Results :
> Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to