TM-84 Reduce noise when excluding tests (#5688)

* TM-84 create intersection between includes and excludes and remove the intersection from the includes, that way we only print relevant exclusions instead of creating noise

* TM-84 add all instead of copy

* TM-84 remove xml from saved artifacts

* TM-84 reverting to default code to investigate behaviour

* TM-84 fixed intersection implementation

* TM-84 more logging to understand behaviour

* TM-84 more debugging

* TM-84 adding wildcard so contains works as expected

* TM-84 tweaking intersection closure

* TM-84 tweaking intersection

* TM-84 small change

* TM-84 suffixing wildcard

* TM-84 finishing up PR

* TM-84 PR comment
This commit is contained in:
Razvan Codreanu 2019-11-12 13:19:31 +00:00 committed by Stefano Franz
parent cc0e92e988
commit 296a8d4ba5

View File

@ -8,6 +8,8 @@ import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.testing.Test
import java.util.stream.Collectors
/**
This plugin is responsible for wiring together the various components of test task modification
*/
@ -212,18 +214,30 @@ class DistributedTesting implements Plugin<Project> {
executedTestsFile.createNewFile()
filter {
List<String> executedTests = executedTestsFile.readLines()
//adding wildcard to each test so they match the ones in the includes list
executedTests.replaceAll({ test -> test + "*" })
def fork = getPropertyAsInt(subProject, "dockerFork", 0)
subProject.logger.info("requesting tests to include in testing task ${task.getPath()} (idx: ${fork})")
List<String> includes = globalAllocator.getTestIncludesForForkAndTestTask(
fork,
task)
subProject.logger.info "got ${includes.size()} tests to include into testing task ${task.getPath()}"
subProject.logger.info "INCLUDE: ${includes.toString()} "
subProject.logger.info "got ${executedTests.size()} tests to exclude from testing task ${task.getPath()}"
subProject.logger.debug "EXCLUDE: ${executedTests.toString()} "
if (includes.size() == 0) {
subProject.logger.info "Disabling test execution for testing task ${task.getPath()}"
excludeTestsMatching "*"
}
includes.removeAll(executedTests)
executedTests.forEach { exclude ->
List<String> intersection = executedTests.stream()
.filter(includes.&contains)
.collect(Collectors.toList())
subProject.logger.info "got ${intersection.size()} tests in intersection"
subProject.logger.info "INTERSECTION: ${intersection.toString()} "
includes.removeAll(intersection)
intersection.forEach { exclude ->
subProject.logger.info "excluding: $exclude for testing task ${task.getPath()}"
excludeTestsMatching exclude
}