Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in container startup are silently ignored and test skipped #256

Open
nefilim opened this issue Jul 24, 2023 · 0 comments
Open

Errors in container startup are silently ignored and test skipped #256

nefilim opened this issue Jul 24, 2023 · 0 comments

Comments

@nefilim
Copy link

nefilim commented Jul 24, 2023

This appears to be the case since 0.40.15 when switching to MUnit 1.0 milestones.

Here's a simple example:

import cats.effect.{IO, Resource}
import com.dimafeng.testcontainers.munit.fixtures.TestContainersFixtures
import munit.CatsEffectSuite
import munit.catseffect.IOFixture

class MinimalSuite extends CatsEffectSuite with TestContainersFixtures {

  lazy val boom: IOFixture[String] =
    ResourceSuiteLocalFixture("badboy", Resource.eval(IO.delay(throw new RuntimeException("boom"))))

  lazy val boomSilent =
    new ForEachContainerFixture({
      println("starting")
      throw new RuntimeException("boomSilent")
    })

  override def munitFixtures = List(boomSilent)

  test("Should test stuff") {
    assertEquals(1, 1)
  }
}
[info] set current project to xx (in build file:/Users/peter/develop/yy/xx/)
starting
MinimalSuite:
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0

previously it reported the error and failed:

[info] compiling 16 Scala sources to /Users/peter/develop/yy/xx/target/test-classes ...
starting
MinimalSuite:
==> X MinimalSuite.expected error running tests  0.001s java.lang.RuntimeException: boomSilent
    at MinimalSuite.boomSilent$lzycompute(MinimalSuite.scala:16)
    at MinimalSuite.boomSilent(MinimalSuite.scala:13)
    at MinimalSuite.munitFixtures(MinimalSuite.scala:19)
    at MinimalSuite.munitFixtures(MinimalSuite.scala:8)
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0
[error] Failed tests:
[error] 	MinimalSuite
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 12 s, completed Jul 24, 2023, 10:02:25 AM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant