LiberatorContainerExtension
A Kotest MountableExtension that runs a Caplin Liberator inside a Testcontainers container for the duration of a test project.
Mount it on a spec to obtain a Liberator handle, which exposes the mapped ports and a factory for opening authenticated StreamLink connections. The container is started lazily on first mount and stopped once via afterProject when the project completes.
class MySpec : FunSpec({
val liberator = install(LiberatorContainerExtension())
test("...") {
val connection = liberator.connect("alice")
autoClose(connection)
// ...
}
})Parameters
how the container is built and how clients authenticate against it. Defaults to a DefaultContainerConfig that builds a Liberator image with a generated KeyMaster key pair. Supply a CustomContainerConfig to run against a pre-built container.
Jackson mapper used when (de)serialising messages over the connection.
Constructors
Types
Describes the container to run and how StreamLink clients authenticate against it.
A ContainerConfig for running against a container and KeyMaster configuration you supply yourself, rather than the one built by DefaultContainerConfig.
A ContainerConfig that builds a Liberator image from the bundled Dockerfile and generates a fresh RSA KeyMaster key pair, deploying the public key into the container.
A handle to a running Liberator container, returned when the extension is mounted.
Functions
Stops the container once the test project has finished.
Starts the container (if not already running) and returns a Liberator handle.