I execute test suite through Gradle for the build and it spins up a lots of processes on different ports. Also, failFast
is set to true
for my test task. So, following happens when I execute my suite:
- Suite starts up and spins up processes/servers listening to different ports
- Tests in the suite are executed
- When one or more tests fails, the suite execution is halted and the build is marked as failed
Now, when failing tests are fixed and the build is eventually run, step 1
(described above) fails with the message that the port is already in use. Also, I am using forkEvery
parameter, meaning the previous tests might have more than one JVM running.
Is there any way to clean everything up (in terms of processes and not the physical files) when a build fails through gradle?