I've got a Scala project which I'm building with sbt
. When running sbt test
, the tests themselves pass, but then the command fails with "Forked test harness failed: java.io.EOFException".
The build.sbt file does not specify fork in Test
.
Example of the error it fails with after running sbt test
:
[info] Run completed in 5 seconds, 494 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[error] Error during tests:
[error] Forked test harness failed: java.io.EOFException
[error] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2959)
[error] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1539)
[error] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
[error] at sbt.React.react(ForkTests.scala:177)
[error] at sbt.ForkTests$Acceptor$1$.run(ForkTests.scala:108)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (serverTests / Test / test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 14 s, completed Mar 12, 2020 4:35:26 PM
Minimal example of test which fails:
package com.example
import akka.http.scaladsl.testkit.ScalatestRouteTest
import org.scalatest.FreeSpecLike
class ForkedTestHarnessFailedForNoReasonSpec extends FreeSpecLike with ScalatestRouteTest {
"This test" - {
"should not fail" in {
assert("Foo" == "Foo")
}
}
}
What does this error indicate and how should one resolve it?
Spontaneous breathing trials (SBT) are used to identify patients who are likely to fail liberation from mechanical ventilation SBT is “the defacto litmus test for determining readiness to breathe without a ventilator” Ideally, during an SBT we want to observe the patient under conditions of respiratory load...
If it is not clear that the patient has passed at 120 minutes the SBT should be considered a failure 80% of patients who tolerate this time can be permanently removed from the ventilator No single parameter should be used to judge SBT success or failure, but a combination of the following are often used:
CRITERIA TO STOP SBT No single parameter should be used to judge SBT success or failure, but a combination of the following are often used: Respiratory rate RR >38 bpm for 5 minutes or <6bpm SpO2 < 92%
By default, sbt runs all tasks in parallel and within the same JVM as sbt itself. Because each test is mapped to a task, tests are also run in parallel by default. To make tests within a given project execute serially: : Test can be replaced with IntegrationTest to only execute integration tests serially.
The cause in my case was that AKKA is shutting down JVM on coordinated shutdown. Put this to your test config (src/test/resources/reference.conf
in my case):
akka.coordinated-shutdown.exit-jvm = off
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With