GH Actions: Add nightly job to run Classic cluster tests (#30572)

* GH Actions: Add nightly job to run Classic cluster tests

* Run tests as multi-jvm instead of multi-node

* Some minor adjustments

* Rename for clarity

* Use JDK 11

* Group some tests to reduce parallelism

* Allow to exclude multi-jvm tests using `-Dakka.test.names.exclude` property

* Exclude akka.cluster.Stress tests

* Move akka classic remoting job to nightly-builds workflow
This commit is contained in:
Marcos Pereira 2021-08-30 11:20:08 -04:00 committed by GitHub
parent 2c4d92e5d4
commit 5e9965a129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 2 deletions

View file

@ -62,6 +62,41 @@ jobs:
Job ${{ github.job }} in workflow ${{ github.workflow }} of ${{github.repository}} failed!
https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
akka-classic-remoting-tests:
name: Akka Classic Remoting Tests
runs-on: ubuntu-20.04
strategy:
matrix:
command:
- akka-cluster/test akka-distributed-data/test akka-cluster-tools/test akka-cluster-metrics/test
- akka-cluster-sharding/test
- akka-cluster-typed/test akka-cluster-sharding-typed/test
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0
- name: Set up JDK 11
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11
- name: Cache Coursier cache
uses: coursier/cache-action@v6.2
- name: sbt ${{ matrix.command }}
run: |-
sbt -jvm-opts .jvmopts-ci \
-Djava.security.egd=file:/dev/./urandom \
-Dakka.remote.artery.enabled=off \
-Dakka.test.timefactor=2 \
-Dakka.cluster.assert=on \
-Dakka.test.tags.exclude=gh-exclude \
-Dakka.test.names.exclude=akka.cluster.Stress \
clean ${{ matrix.command }}
jdk-nightly-tests:
name: JDK ${{ matrix.jdkVersion }} / Scala ${{ matrix.scalaVersion }}
runs-on: ubuntu-20.04

View file

@ -454,7 +454,7 @@ abstract class StressSpec
override def beforeEach(): Unit = { step += 1 }
override def expectedTestDuration = settings.expectedTestDuration
override def expectedTestDuration: FiniteDuration = settings.expectedTestDuration
override def shutdownTimeout: FiniteDuration = 30.seconds.dilated

View file

@ -95,7 +95,11 @@ object MultiJvmPlugin extends AutoPlugin {
multiJvmMarker := "MultiJvm",
loadedTestFrameworks := (loadedTestFrameworks in Test).value,
definedTests := Defaults.detectTests.value,
multiJvmTests := collectMultiJvm(definedTests.value.map(_.name), multiJvmMarker.value),
multiJvmTests := collectMultiJvmTests(
definedTests.value,
multiJvmMarker.value,
(MultiJvm / testOptions).value,
streams.value.log),
multiJvmTestNames := multiJvmTests.map(_.keys.toSeq).storeAs(multiJvmTestNames).triggeredBy(compile).value,
multiJvmApps := collectMultiJvm(discoveredMainClasses.value, multiJvmMarker.value),
multiJvmAppNames := multiJvmApps.map(_.keys.toSeq).storeAs(multiJvmAppNames).triggeredBy(compile).value,
@ -166,6 +170,43 @@ object MultiJvmPlugin extends AutoPlugin {
name.value + "_" + scalaVersion.value + "-" + version.value + "-multi-jvm-assembly.jar"
})
def collectMultiJvmTests(
discovered: Seq[TestDefinition],
marker: String,
testOptions: Seq[TestOption],
log: Logger): Map[String, Seq[String]] = {
val testFilters = new collection.mutable.ListBuffer[String => Boolean]
val excludeTestsSet = new collection.mutable.HashSet[String]
for (option <- testOptions) {
option match {
case Tests.Exclude(excludedTests) => excludeTestsSet ++= excludedTests
case Tests.Filter(filterTestsIn) => testFilters += filterTestsIn
case _ => // do nothing since the intention is only to filter tests
}
}
if (excludeTestsSet.nonEmpty) {
log.debug(excludeTestsSet.mkString("Excluding tests: \n\t", "\n\t", ""))
}
def includeTest(test: TestDefinition): Boolean = {
!excludeTestsSet.contains(test.name) && testFilters.forall(filter => filter(test.name)) && test.name.contains(
marker)
}
val groupedTests: Map[String, List[TestDefinition]] =
discovered.filter(includeTest).toList.distinct.groupBy(test => multiName(test.name, marker))
groupedTests.map {
case (key, values) =>
val totalNodes = sys.props.get(marker + "." + key + ".nrOfNodes").getOrElse(values.size.toString).toInt
val sortedClasses = values.map(_.name).sorted
val totalClasses = sortedClasses.padTo(totalNodes, sortedClasses.last)
(key, totalClasses)
}
}
def collectMultiJvm(discovered: Seq[String], marker: String): Map[String, Seq[String]] = {
val found = discovered.filter(_.contains(marker)).groupBy(multiName(_, marker))
found.map {