Add custom TestNGTestTransformer that adds a maximum test runtime of 10 minutes to all testng tests
-- Closes GSA-494 / Add maximum runtime for integration tests, running them in timeout thread -- Needed to debug locking issues -- Needed to debug excessively long running integrationtests -- Added build.xml maximum runtime for all testng tests of 10 hours. We will ultimately fail the build if it goes on for more than 10 hours
This commit is contained in:
parent
7dd7afe739
commit
872abddfce
|
|
@ -1174,14 +1174,16 @@
|
|||
<echo message="" />
|
||||
<echo message="Sting: Running @{testtype} test cases!"/>
|
||||
|
||||
<!-- no test is allowed to run for more than 10 hours -->
|
||||
<taskdef resource="testngtasks" classpath="${testng.jar}"/>
|
||||
<testng outputDir="@{outputdir}"
|
||||
classpathref="${testng.classpath}"
|
||||
haltOnFailure="false" failureProperty="test.failure"
|
||||
verbose="2"
|
||||
timeout="36000000"
|
||||
workingDir="${basedir}"
|
||||
useDefaultListeners="false"
|
||||
listeners="org.testng.reporters.FailedReporter,org.testng.reporters.JUnitXMLReporter,org.broadinstitute.sting.StingTextReporter,org.uncommons.reportng.HTMLReporter">
|
||||
listeners="org.testng.reporters.FailedReporter,org.testng.reporters.JUnitXMLReporter,org.broadinstitute.sting.TestNGTestTransformer,org.broadinstitute.sting.StingTextReporter,org.uncommons.reportng.HTMLReporter">
|
||||
<jvmarg value="-Xmx${test.maxmemory}" />
|
||||
<jvmarg value="-ea" />
|
||||
<jvmarg value="-Djava.awt.headless=true" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package org.broadinstitute.sting;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.testng.IAnnotationTransformer;
|
||||
import org.testng.annotations.ITestAnnotation;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* Provide default @Test values for GATK testng tests.
|
||||
*
|
||||
* Currently only sets the maximum runtime to 10 minutes, if it's not been specified.
|
||||
*
|
||||
* See http://beust.com/weblog/2006/10/18/annotation-transformers-in-java/
|
||||
*
|
||||
* @author depristo
|
||||
* @since 10/31/12
|
||||
* @version 0.1
|
||||
*/
|
||||
public class TestNGTestTransformer implements IAnnotationTransformer {
|
||||
public static final long DEFAULT_TIMEOUT = 1000 * 60 * 10; // 10 minutes max per test
|
||||
|
||||
final static Logger logger = Logger.getLogger(TestNGTestTransformer.class);
|
||||
|
||||
public void transform(ITestAnnotation annotation,
|
||||
Class testClass,
|
||||
Constructor testConstructor,
|
||||
Method testMethod)
|
||||
{
|
||||
if ( annotation.getTimeOut() == 0 ) {
|
||||
logger.warn("test " + testMethod.toString() + " has no specified timeout, adding default timeout " + DEFAULT_TIMEOUT / 1000 / 60 + " minutes");
|
||||
annotation.setTimeOut(DEFAULT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue