Add checkTestsHaveRun task to check tests have run (#28350)

Extend JUnitSuite to make sure the test is included in the report.

After merging this, nothing would happen. We should then invoke
`checkTestsHaveRun` from the jenkins nightly builds. That should then
fail the build until we merge #28347 and switch the nightly builds
to run on JDK11.
This commit is contained in:
Arnout Engelen 2019-12-13 11:29:20 +01:00 committed by GitHub
parent 7d51a8d5f9
commit 21fbfe6724
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -14,6 +14,8 @@ object TestExtras {
val excludeTestNames = settingKey[Set[String]]("Names of tests to be excluded. Not supported by MultiJVM tests. Example usage: -Dakka.test.names.exclude=TimingSpec")
val excludeTestTags = settingKey[Set[String]]("Tags of tests to be excluded. It will not be used if you specify -Dakka.test.tags.only. Example usage: -Dakka.test.tags.exclude=long-running")
val onlyTestTags = settingKey[Set[String]]("Tags of tests to be ran. Example usage: -Dakka.test.tags.only=long-running")
val checkTestsHaveRun = taskKey[Unit]("Verify a number of notable tests have actually run");
}
import Keys._
@ -46,7 +48,19 @@ object TestExtras {
testOptions in Test ++= {
val tags = onlyTestTags.value
if (tags.isEmpty) Seq.empty else Seq(Tests.Argument("-n", tags.mkString(" ")))
})
},
checkTestsHaveRun := {
require(
file("akka-stream-tests/target/test-reports/TEST-akka.stream.scaladsl.FlowPublisherSinkSpec.xml").exists,
"The jdk9-only FlowPublisherSinkSpec.scala should be run as part of the build"
)
require(
file("akka-stream-tests/target/test-reports/TEST-akka.stream.javadsl.JavaFlowSupportCompileTest.xml").exists,
"The jdk9-only JavaFlowSupportCompileTest.java should be run as part of the build"
)
}
)
}
def containsOrNotExcludesTag(tag: String) = {