Skip to content

//tempest2-testing-docker/app.cash.tempest2.testing/Container

Container

[jvm]\ data class Container(val createCmd: CreateContainerCmd.() -> Unit, val beforeStartHook: (docker: DockerClient, id: String) -> Unit)

A Container creates a Docker container for testing.

Tests provide a lambda to build a CreateContainerCmd. The createCmd lambda must set CreateContainerCmd.withName and CreateContainerCmd.withImage. All other fields are optional. The Composer takes care of setting up the network.

There may be a need to configure your container between the creation and start steps. beforeStartHook provides you with an id to your container allowing you to manipulate as necessary before the command/entrypoint is invoked.

See Composer for an example.

Constructors

Container [jvm]
constructor(createCmd: CreateContainerCmd.() -> Unit)constructor(createCmd: CreateContainerCmd.() -> Unit, beforeStartHook: (docker: DockerClient, id: String) -> Unit)

Properties

Name Summary
beforeStartHook [jvm]
val beforeStartHook: (docker: DockerClient, id: String) -> Unit
createCmd [jvm]
val createCmd: CreateContainerCmd.() -> Unit