As per title: I\'m trying to run Maven automated test from Jenkins slave that is containerized and after battling this for a week now I\'m running out of ideas. It works as
I know it's been a while but will add my solution to the problem which took me more than a day to FIX.
Problem: I'm running my integration tests in the PaaS in a docker container and have no control on the memory allocation for my process. the default behavior is for failsafe/surfire to fork a JVM and run the tests on it. I could not find a way to control the memory allocation for that forked JVM and tests kept failing with the error "Error occurred in starting fork" also saw "The forked VM terminated without saying properly goodbye docker" in the logs depending on which version of failsafe I was trying.
Solution: My solution was to disable forking of the JVM and have all the tests run in the same JVM as the main maven process, now this may not be the ideal solution for many but it would work if you can only control the max memory allocation of the main maven process.
To disable forking it's as simple as setting the forkMode in the config:
org.apache.maven.plugins
maven-failsafe-plugin
0
.....
UPDATE: Since giving this solution it seems like you can now pass params to the forked JVM so shouldn't need the earlier solution.
From the maven docs under Forked Test Execution:
With the
argLineproperty, you can specify additional parameters to be passed to the forked JVM process, such as memory settings. System property variables from the main maven process are passed to the forked process as well. Additionally, you can use the elementsystemPropertyVariablesto specify variables and values to be added to the system properties during the test execution.
https://maven.apache.org/surefire/maven-failsafe-plugin/examples/fork-options-and-parallel-execution.html