From 779f80d83c44181e2e09c5c9952c92bf3f56f74b Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Tue, 20 Aug 2019 23:06:52 -0700 Subject: [PATCH] Run tests in parallel (#629) * Disable concurrent tests in jmx, log * Use parallelExecution settings * Optimize scan test interval --- .../scala/wvlet/log/LogLevelScannerTest.scala | 8 ++++---- build.sbt | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/airframe-log/jvm/src/test/scala/wvlet/log/LogLevelScannerTest.scala b/airframe-log/jvm/src/test/scala/wvlet/log/LogLevelScannerTest.scala index 57ea29ad27..19ddb8d4f2 100644 --- a/airframe-log/jvm/src/test/scala/wvlet/log/LogLevelScannerTest.scala +++ b/airframe-log/jvm/src/test/scala/wvlet/log/LogLevelScannerTest.scala @@ -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 { @@ -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) } @@ -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) } } @@ -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) diff --git a/build.sbt b/build.sbt index 2ca8c00158..7889037e70 100644 --- a/build.sbt +++ b/build.sbt @@ -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 ) @@ -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") @@ -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,