Add assertion checking if task was put into build cache.
^KT-45745 In Progress
This commit is contained in:
+12
-1
@@ -63,7 +63,9 @@ fun BuildResult.assertTasksFromCache(vararg tasks: String) {
|
||||
tasks.forEach { task ->
|
||||
assert(task(task)?.outcome == TaskOutcome.FROM_CACHE) {
|
||||
printBuildOutput()
|
||||
"Task $task didn't have 'FROM_CACHE' state: ${task(task)?.outcome}"
|
||||
val occurrences = output.lineSequence().filter { it.contains("> Task $task") }
|
||||
System.err.println("ZZZ: task results ${occurrences.joinToString(separator = "\n")}")
|
||||
"Task $task didn't have 'FROM-CACHE' state: ${task(task)?.outcome}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,3 +81,12 @@ fun BuildResult.assertTasksNoSource(vararg tasks: String) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert new cache entry was created for given [tasks].
|
||||
*/
|
||||
fun BuildResult.assertTasksPackedToCache(vararg tasks: String) {
|
||||
tasks.forEach {
|
||||
assertOutputContains("Stored cache entry for task '$it' with cache key ")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user