Fargier Stephane created SUREFIRE-918:
-----------------------------------------

             Summary: Phase post-integration-test not executed when tests are 
timed out with option 'forkedProcessTimeoutInSeconds'
                 Key: SUREFIRE-918
                 URL: https://jira.codehaus.org/browse/SUREFIRE-918
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Failsafe Plugin
    Affects Versions: 2.12.4
         Environment: Windows 7 64 bits
Ubuntu 11.10 64 bits
            Reporter: Fargier Stephane
         Attachments: failsafe-timeout.zip

In a project we use the failsafe plugin for our ITs.
The option 'forkedProcessTimeoutInSeconds' is used to have a time limit for the 
test execution.
{code}
<configuration>
        <forkedProcessTimeoutInSeconds>3</forkedProcessTimeoutInSeconds>
</configuration>
{code}

We also have goals registered in the post-integration-phase for environment 
clean-up.

When the tests are in timeout, the maven execution is stopped and the 
post-integration-test phase is not executed, leaving our environment dirty. The 
post-integration-test phase should be executed after timeout the same way it is 
executed after failed tests.


Attached is a simple project illustrating the issue:
* a JUnit test that runs forever
* a goal is registered in the post-integration phase
* the timeout is set on the project

If you run it, you will see the post-integration-phase is not executed:
{code}
[INFO] --- maven-failsafe-plugin:2.12.4:integration-test (integration-test) @ 
failsave.timeout.example ---
[INFO] Failsafe report directory: 
/home/sfargier/Téléchargements/failsafe-timeout/target/failsafe-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestRunsForeverITCase

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.468s
[INFO] Finished at: Wed Oct 31 14:20:58 CET 2012
[INFO] Final Memory: 9M/490M
[INFO] ------------------------------------------------------------------------
{code}


As a side-note, if we set the forkMode option to 'always', then the 
post-integration-test is executed even if the timeout expires. But there are 
some Java processes for the tests (the one running surefire-booter-*.jar) that 
are not killed. There seems to be an already opened issue for that 
(http://jira.codehaus.org/browse/SUREFIRE-773).


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


Reply via email to