We mostly have task-caching disabled for our test-tasks, due to issues with test flakiness. We would very much like to make use of it, and are wondering if it is possible to prevent results getting saved to the cache, if the test-task produced test-failures (without, however, having to make that task actually fail / fail the build).
The way we run a lot of tests in CI (in a larger multi-project build) is to run a given test-task across all projects in a given job, and we generally want all those tasks to complete (whether there were some test-failures or not). So making one of those tasks fail the build in case of test-failures is not really an option for us, which is why we have
ignoreFailures = true set for the tasks.
Is there any way this could be achieved? This would be a very helpful feature for us - it would allow us to enable caching, but still be sure that only “good” results actually get to be stored in the cache. Otherwise, with caching we frequently see that some flaky tests appear as “persistently-failing” across builds, because their failures got cached along - which can be quite confusing and which we want to avoid.
Any help appreciated.
Context: We’re running Gradle 5.4.1 (so not quite the most recent version), in case that’s of relevance. Updates pending