Packages

p

munit

package munit

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. munit
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. abstract class HttpFromContainerSuite extends HttpSuite with TestContainersSuite

    Base class for suites testing HTTP servers running in docker containers using testcontainers.

    Base class for suites testing HTTP servers running in docker containers using testcontainers.

    To use this class you'll need to select also one of the two testcontainers specific suites: TestContainersForAll or TestContainersForEach. Also you'll need to override the val containerDef: ContainerDef definition with your container. Lastly you'll need to ensure your container's URI is obtainable either by using the default extractor (which just uses localhost:first-exposed-port) or providing an specific one for your container by overriding the http4sMUnitContainerUriExtractor list.

    Example:
    1. import scala.concurrent.ExecutionContext.global
      
      import cats.effect.IO
      import cats.effect.Resource
      
      import com.dimafeng.testcontainers.ContainerDef
      import com.dimafeng.testcontainers.GenericContainer
      import com.dimafeng.testcontainers.munit.TestContainerForAll
      
      import org.http4s.Method.GET
      import org.http4s.client.Client
      import org.http4s.ember.client.EmberClientBuilder
      import org.http4s.client.dsl.io._
      import org.http4s.syntax.all._
      
      import org.testcontainers.containers.wait.strategy.Wait
      
      class HttpFromContainerSuiteSuite extends munit.HttpFromContainerSuite with TestContainerForAll {
      
        override def http4sMUnitClient: Resource[IO, Client[IO]] = BlazeClientBuilder[IO](global).resource
      
        override val containerDef = new ContainerDef {
      
          override type Container = GenericContainer
      
          protected def createContainer(): GenericContainer = GenericContainer(
            dockerImage = "briceburg/ping-pong",
            exposedPorts = Seq(80)
          )
      
        }
      
        test(GET(uri"ping")) { response =>
          assertEquals(response.status.code, 200)
      
          assertIO(response.as[String], "pong")
        }
      
      }

Value Members

  1. val Fail: Tag
  2. val Flaky: Tag
  3. val Ignore: Tag
  4. val Only: Tag
  5. val Slow: Tag

Inherited from AnyRef

Inherited from Any

Ungrouped