Skip to content

Commit

Permalink
Run tests in parallel (#629)
Browse files Browse the repository at this point in the history
* Disable concurrent tests in jmx, log
* Use parallelExecution settings
* Optimize scan test interval
  • Loading branch information
xerial committed Aug 21, 2019
1 parent 5a0807b commit 779f80d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Expand Up @@ -39,7 +39,7 @@ class LogLevelScannerTest extends Spec {
scanner.start
// Wait the first scan
while (scanner.scanCount.get == lastScanCount) {
Thread.sleep(1000)
Thread.sleep(15)
}
f
} finally {
Expand All @@ -63,7 +63,7 @@ class LogLevelScannerTest extends Spec {

// Load log-test.properties
withScanner(
LogLevelScannerConfig(LogLevelScanner.DEFAULT_LOGLEVEL_FILE_CANDIDATES, Duration(500, TimeUnit.MILLISECONDS))
LogLevelScannerConfig(LogLevelScanner.DEFAULT_LOGLEVEL_FILE_CANDIDATES, Duration(10, TimeUnit.MILLISECONDS))
) {
assert(l.getLogLevel == LogLevel.DEBUG)
}
Expand All @@ -74,7 +74,7 @@ class LogLevelScannerTest extends Spec {
l.setLogLevel(LogLevel.WARN)
assert(l.getLogLevel == LogLevel.WARN)

withScanner(LogLevelScannerConfig(List("wvlet/log/custom-log.properties"), Duration(500, TimeUnit.MILLISECONDS))) {
withScanner(LogLevelScannerConfig(List("wvlet/log/custom-log.properties"), Duration(10, TimeUnit.MILLISECONDS))) {
assert(l.getLogLevel == LogLevel.ERROR)
}
}
Expand All @@ -84,7 +84,7 @@ class LogLevelScannerTest extends Spec {
l.setLogLevel(LogLevel.TRACE)

withScanner(
LogLevelScannerConfig(List("wvlet/log/invalid-loglevel.properties"), Duration(500, TimeUnit.MILLISECONDS))
LogLevelScannerConfig(List("wvlet/log/invalid-loglevel.properties"), Duration(10, TimeUnit.MILLISECONDS))
) {
// Should ignore unknown log level string
assert(l.getLogLevel == LogLevel.TRACE)
Expand Down
15 changes: 8 additions & 7 deletions build.sbt
Expand Up @@ -81,14 +81,13 @@ val buildSettings = Seq[Setting[_]](
)
)

// Do not run tests concurrently to avoid JMX registration failures
val runTestSequentially = Seq[Setting[_]](parallelExecution in Test := false)

// We need to define this globally as a workaround for https://github.com/sbt/sbt/pull/3760
publishTo in ThisBuild := sonatypePublishTo.value

val jsBuildSettings = Seq[Setting[_]](
// Do not run tests concurrently
concurrentRestrictions in Global := Seq(
Tags.limit(Tags.Test, 1)
)
// Workaround for ' JSCom has been closed' issue
//parallelExecution in ThisBuild := false
)
Expand Down Expand Up @@ -448,7 +447,9 @@ lazy val jmx =
.settings(buildSettings)
.settings(
name := "airframe-jmx",
description := "A library for exposing Scala object data through JMX"
description := "A library for exposing Scala object data through JMX",
// Do not run tests concurrently to avoid JMX registration failures
runTestSequentially
)
.dependsOn(surfaceJVM, airspecRefJVM % "test")

Expand Down Expand Up @@ -485,8 +486,8 @@ lazy val log: sbtcrossproject.CrossProject =
libraryDependencies ++= logDependencies(scalaVersion.value)
)
.jvmSettings(
libraryDependencies ++= logJVMDependencies
//classLoaderLayeringStrategy in Test := ClassLoaderLayeringStrategy.AllLibraryJars
libraryDependencies ++= logJVMDependencies,
runTestSequentially
)
.jsSettings(
jsBuildSettings,
Expand Down

0 comments on commit 779f80d

Please sign in to comment.