mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-01-19 18:14:44 +00:00
Enable quiet tests using SBT config (#318)
* Enable quiet tests using SBT config * Add logback-test.xml config to reduce log messages * Hide "resolving" messages in CI environment * Improve ScalaTest options to reduce SuiteStart events * Hide EVEN MORE Specs2 output
This commit is contained in:
parent
50df2bace0
commit
ae7f8bf71d
|
|
@ -5,8 +5,8 @@ dist: trusty
|
||||||
scala:
|
scala:
|
||||||
- 2.11.8
|
- 2.11.8
|
||||||
env:
|
env:
|
||||||
- SBT_COMMAND="test:compile test packArchiveZip"
|
- SBT_COMMAND="test:compile quiet:test packArchiveZip"
|
||||||
- SBT_COMMAND="coverage test:compile test coverageReport"
|
- SBT_COMMAND="coverage test:compile quiet:test coverageReport"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
|
|
||||||
29
build.sbt
29
build.sbt
|
|
@ -3,8 +3,21 @@ lazy val commonSettings = Seq(
|
||||||
version := "1.0.2-SNAPSHOT",
|
version := "1.0.2-SNAPSHOT",
|
||||||
scalaVersion := "2.11.8",
|
scalaVersion := "2.11.8",
|
||||||
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8", "-language:postfixOps"),
|
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8", "-language:postfixOps"),
|
||||||
// scaladoc flags: https://github.com/scala/scala/blob/2.11.x/src/scaladoc/scala/tools/nsc/doc/Settings.scala
|
|
||||||
|
// Quiet test options
|
||||||
|
// https://github.com/etorreborre/specs2/blob/8305db76c5084e4b3ce5827ce23117f6fb6beee4/common/shared/src/main/scala/org/specs2/main/Report.scala#L94
|
||||||
|
// https://etorreborre.github.io/specs2/guide/SPECS2-2.4.17/org.specs2.guide.Runners.html
|
||||||
|
testOptions in QuietTest += Tests.Argument(TestFrameworks.Specs2, "showOnly", "x!"),
|
||||||
|
// http://www.scalatest.org/user_guide/using_the_runner
|
||||||
|
testOptions in QuietTest += Tests.Argument(TestFrameworks.ScalaTest, "-oCEHILMNOPQRX"),
|
||||||
|
// TODO: remove when upgraded to SBT 1.0+ https://github.com/sbt/sbt/pull/2747/files
|
||||||
|
ivyLoggingLevel := {
|
||||||
|
// This will suppress "Resolving..." logs on Jenkins and Travis.
|
||||||
|
if (sys.env.get("BUILD_NUMBER").isDefined || sys.env.get("CI").isDefined) UpdateLogging.Quiet
|
||||||
|
else UpdateLogging.Default
|
||||||
|
},
|
||||||
// Trick taken from https://groups.google.com/d/msg/scala-user/mxV9ok7J_Eg/kt-LnsrD0bkJ
|
// Trick taken from https://groups.google.com/d/msg/scala-user/mxV9ok7J_Eg/kt-LnsrD0bkJ
|
||||||
|
// scaladoc flags: https://github.com/scala/scala/blob/2.11.x/src/scaladoc/scala/tools/nsc/doc/Settings.scala
|
||||||
scalacOptions in (Compile,doc) <<= baseDirectory map {
|
scalacOptions in (Compile,doc) <<= baseDirectory map {
|
||||||
bd => Seq(
|
bd => Seq(
|
||||||
"-groups",
|
"-groups",
|
||||||
|
|
@ -54,26 +67,36 @@ lazy val psloginPackSettings = packAutoSettings ++ Seq(
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val root = (project in file(".")).
|
lazy val root = (project in file(".")).
|
||||||
|
configs(QuietTest).
|
||||||
settings(commonSettings: _*).
|
settings(commonSettings: _*).
|
||||||
//enablePlugins(ScalaUnidocPlugin).
|
//enablePlugins(ScalaUnidocPlugin).
|
||||||
settings(psloginPackSettings: _*).
|
settings(psloginPackSettings: _*).
|
||||||
aggregate(pslogin, common)
|
aggregate(pslogin, common)
|
||||||
|
|
||||||
lazy val pslogin = (project in file("pslogin")).
|
lazy val pslogin = (project in file("pslogin")).
|
||||||
|
configs(QuietTest).
|
||||||
settings(commonSettings: _*).
|
settings(commonSettings: _*).
|
||||||
settings(
|
settings(
|
||||||
name := "pslogin",
|
name := "pslogin",
|
||||||
// ActorTests have specific timing requirements and will be flaky if run in parallel
|
// ActorTests have specific timing requirements and will be flaky if run in parallel
|
||||||
parallelExecution in Test := false,
|
parallelExecution in Test := false,
|
||||||
// TODO(chord): remove exclusion when WorldSessionActor is refactored: https://github.com/psforever/PSF-LoginServer/issues/279
|
// TODO(chord): remove exclusion when WorldSessionActor is refactored: https://github.com/psforever/PSF-LoginServer/issues/279
|
||||||
coverageExcludedPackages := "WorldSessionActor.*;zonemaps.*"
|
coverageExcludedPackages := "WorldSessionActor.*;zonemaps.*",
|
||||||
|
// Copy all tests from Test -> QuietTest (we're only changing the run options)
|
||||||
|
inConfig(QuietTest)(Defaults.testTasks)
|
||||||
).
|
).
|
||||||
settings(pscryptoSettings: _*).
|
settings(pscryptoSettings: _*).
|
||||||
dependsOn(common)
|
dependsOn(common)
|
||||||
|
|
||||||
lazy val common = (project in file("common")).
|
lazy val common = (project in file("common")).
|
||||||
|
configs(QuietTest).
|
||||||
settings(commonSettings: _*).
|
settings(commonSettings: _*).
|
||||||
settings(
|
settings(
|
||||||
name := "common"
|
name := "common",
|
||||||
|
// Copy all tests from Test -> QuietTest (we're only changing the run options)
|
||||||
|
inConfig(QuietTest)(Defaults.testTasks)
|
||||||
).
|
).
|
||||||
settings(pscryptoSettings: _*)
|
settings(pscryptoSettings: _*)
|
||||||
|
|
||||||
|
// Special test configuration for really quiet tests (used in CI)
|
||||||
|
lazy val QuietTest = config("quiet") extend(Test)
|
||||||
|
|
|
||||||
11
common/src/test/resources/logback-test.xml
Normal file
11
common/src/test/resources/logback-test.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="ERROR">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
11
pslogin/src/test/resources/logback-test.xml
Normal file
11
pslogin/src/test/resources/logback-test.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>[%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="ERROR">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
Loading…
Reference in a new issue