failsafe: proper shutdown on failure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

failsafe: proper shutdown on failure

Veit Guna
Hi.

I'm using maven failsafe 2.20.1 to setup my test environment (redis, via fabric8/docker-maven-plugin) before ITs using pre-integration-test and shut it down on post-integration-test. It works just fine when tests are succeeding or failing "normally". But when failing "hard" like this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test (default) on project crs-it: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:

Due to some class not found exceptions,

or just executing:

mvn clean verify -Dit.test=nonExistingTest

It seems that post-integration-test phase isn't executed properly then, leaving my docker container still running.

Is this expected behavior? If so, how can I make sure that my services startup in pre-integration-test phase are properly shutdown?
I setup my pom.xml according to failsafe documentation:

<build>
        <plugins>
                <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.20.1</version>
                        <executions>
                                <execution>
                                        <goals>
                                                <goal>integration-test</goal>
                                                <goal>verify</goal>
                                        </goals>
                                </execution>
                        </executions>
                </plugin>
                <!-- local redis -->
                <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.22.1</version>
                        <configuration>
                                <skip>${skipITs}</skip>
                                <images>
                                        <image>
                                                <name>redis</name>
                                                <alias>redis</alias>
                                                <run>
                                                        <ports>
                                                                <port>${redis.port}:6379</port>
                                                        </ports>
                                                        <wait>
                                                                <tcp>
                                                                        <host>127.0.0.1</host>
                                                                        <ports>
                                                                                <port>${redis.port}</port>
                                                                        </ports>
                                                                </tcp>
                                                        </wait>
                                                </run>
                                        </image>
                                </images>
                        </configuration>
                        <executions>
                                <execution>
                                        <id>start</id>
                                        <phase>pre-integration-test</phase>
                                        <goals>
                                                <goal>build</goal>
                                                <goal>start</goal>
                                        </goals>
                                </execution>
                                <execution>
                                        <id>stop</id>
                                        <phase>post-integration-test</phase>
                                        <goals>
                                                <goal>stop</goal>
                                        </goals>
                                </execution>
                        </executions>
                </plugin>
        </plugins>
</build>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: failsafe: proper shutdown on failure

Mark Prins
On 02-10-17 12:12, Veit Guna wrote:

> Hi.
>
> I'm using maven failsafe 2.20.1 to setup my test environment (redis, via fabric8/docker-maven-plugin) before ITs using pre-integration-test and shut it down on post-integration-test. It works just fine when tests are succeeding or failing "normally". But when failing "hard" like this:
>
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test (default) on project crs-it: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test failed: There was an error in the forked process
> [ERROR] org.testng.TestNGException:
>
> Due to some class not found exceptions,
>
> or just executing:
>
> mvn clean verify -Dit.test=nonExistingTest
>
> It seems that post-integration-test phase isn't executed properly then, leaving my docker container still running.

I think the build is halted after the failure, so no further phases are
processed. Using "-fae" (fail-at-end) may help, but I may be wrong.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Aw: Re: failsafe: proper shutdown on failure

Veit Guna
Hi Mark.

I've tried -fae but without luck.

When the build system is halted, shouldn't at least the post-integration-test phase properly executed in order to be consistent?

I also have a cargo container running during ITs which gets "shutdown" during halt - but most likely due to the fact that
the JVM is killed. Docker runs in a separate process so it isn't affected by the JVM shutdown. Hence it is still running.



> Gesendet: Montag, 02. Oktober 2017 um 17:04 Uhr
> Von: "Mark Prins" <[hidden email]>
> An: [hidden email]
> Betreff: Re: failsafe: proper shutdown on failure
>
> On 02-10-17 12:12, Veit Guna wrote:
> > Hi.
> >
> > I'm using maven failsafe 2.20.1 to setup my test environment (redis, via fabric8/docker-maven-plugin) before ITs using pre-integration-test and shut it down on post-integration-test. It works just fine when tests are succeeding or failing "normally". But when failing "hard" like this:
> >
> > [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test (default) on project crs-it: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:integration-test failed: There was an error in the forked process
> > [ERROR] org.testng.TestNGException:
> >
> > Due to some class not found exceptions,
> >
> > or just executing:
> >
> > mvn clean verify -Dit.test=nonExistingTest
> >
> > It seems that post-integration-test phase isn't executed properly then, leaving my docker container still running.
>
> I think the build is halted after the failure, so no further phases are
> processed. Using "-fae" (fail-at-end) may help, but I may be wrong.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]