Hi,
I am the author of the dockerized test plugin and recently I am experimenting with test running in a cluster of docker hosts, i.e. Gradle tests worker processes running on a remote machine. It turned out that ForkingTestClassProcessor
code is not robust enough: worker process can die before the connection gets established, or even connections could not be established due to some temp networking issue. This leads to failing test rounds, quite unnecessarily - a test class processor could try to start the worker again, hoping that this time everything will be ok, or if not throw the error if the number of attempts has reached some threshold.
Unfortunately, in order to implement such a strategy in my plugin, I need literally to copy a few classes from Gradle codebase and adjust relevant parts because factories are declared as anonymous classes, or the methods I need to overwrite are declared as private or package visible. IMHO, it would be a way better if the relevant Gradle classes could be extended, overwriting relevant factory methods, or even injecting relevant factories directly in Test
task.
I am proposing that we:
- either add `getters and setters for
Factory<TestClassProcessor>
andRunnable testClassScannerFactory
toTest
task, or - adding similar methods to
DefaultTestExecuter
, declare fields and the new methods as protected
What do Gradle maintainers think? I would gladly provide a PR.
Thanks,
Predrag