Categorygithub.com/prongq/testcontainers-go
modulepackage
0.0.0-20230908121236-79823b6dadbb
Repository: https://github.com/prongq/testcontainers-go.git
Documentation: pkg.go.dev

# README

Testcontainers

Open in GitHub Codespaces

Main pipeline Go Report Card GoDoc Reference

Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.

You can find more information about Testcontainers for Go at golang.testcontainers.org, which is rendered from the ./docs directory.

Using Testcontainers for Go

Please visit the quickstart guide to understand how to add the dependency to your Go project.

# Packages

No description provided by the author
No description provided by the author

# Functions

BindMount returns a new ContainerMount with a GenericBindMountSource as source This is a convenience method to cover typical use cases.
CustomizeRequest returns a function that can be used to merge the passed container request with the one that is used by the container.
DockerImageAuth returns the auth config for the given Docker image, extracting first its Docker registry.
No description provided by the author
GenericContainer creates a generic container with parameters.
GenericNetwork creates a generic network with parameters.
Deprecated: this function will be removed in a future release LogDockerServerInfo logs the docker server info using the provided logger and Docker client.
Mounts returns a ContainerMounts to support a more fluent API.
Deprecated: Use NewDockerClientWithOpts instead.
No description provided by the author
NewDockerProvider creates a Docker provider with the EnvClient.
NewReaper creates a Reaper with a sessionID to identify containers and a provider to use Deprecated: it's not possible to create a reaper anymore.
ParallelContainers creates a generic containers with parameters and run it in parallel mode.
ReadConfig reads from testcontainers properties file, storing the result in a singleton instance of the TestcontainersConfig struct.
SkipIfDockerDesktop is a utility function capable of skipping tests if tests are run using Docker Desktop.
SkipIfProviderIsNotHealthy is a utility function capable of skipping tests if the provider is not healthy, or running at all.
TestLogger returns a Logging implementation for testing.TB This way logs from testcontainers are part of the test output of a test suite or test case.
VolumeMount returns a new ContainerMount with a GenericVolumeMountSource as source This is a convenience method to cover typical use cases.
WithConfigModifier allows to override the default container config.
No description provided by the author
WithEndpointSettingsModifier allows to override the default endpoint settings.
WithHostConfigModifier allows to override the default host config.
WithImage sets the image for a container.
WithImageName sets the reaper image name.
WithLogger is a generic option that implements GenericProviderOption, DockerProviderOption It replaces the global Logging implementation with a user defined one e.g.
Deprecated: Testcontainers will detect registry credentials automatically WithRegistryCredentials sets the reaper registry credentials.
WithWaitStrategy sets the wait strategy for a container, using 60 seconds as deadline.
WithWaitStrategyAndDeadline sets the wait strategy for a container, including deadline.

# Constants

Bridge network name (as well as driver).
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
default will auto-detect provider from DOCKER_HOST environment variable.
possible provider types.
possible provider types.
Default network name when bridge is not available.
No description provided by the author
StderrLog is the log type for STDERR.
StdoutLog is the log type for STDOUT.
Deprecated: it has been replaced by the internal testcontainersdocker.LabelLang.
Deprecated: it has been replaced by the internal testcontainersdocker.LabelReaper.
Deprecated: it has been replaced by the internal testcontainersdocker.LabelSessionID.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Logger is the default log instance.

# Structs

No description provided by the author
ContainerLifecycleHooks is a struct that contains all the hooks that can be used to modify the container lifecycle.
ContainerMount models a mount into a container.
ContainerRequest represents the parameters used to get a running container.
No description provided by the author
DockerClient is a wrapper around the docker client that is used by testcontainers-go.
DockerContainer represents a container started using Docker.
DockerNetwork represents a network started using Docker.
DockerProvider implements the ContainerProvider interface.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
FromDockerfile represents the parameters needed to build an image from a Dockerfile rather than using a pre-built one.
GenericBindMountSource implements ContainerMountSource and represents a bind mount Optionally mount.BindOptions might be added for advanced scenarios.
GenericContainerRequest represents parameters to a generic container.
GenericNetworkRequest represents parameters to a generic network.
No description provided by the author
GenericTmpfsMountSource implements ContainerMountSource and represents a TmpFS mount Optionally mount.TmpfsOptions might be added for advanced scenarios.
GenericVolumeMountSource implements ContainerMountSource and represents a volume mount.
Log represents a message that was created by a process, LogType is either "STDOUT" or "STDERR", Content is the byte contents of the message itself.
No description provided by the author
NetworkRequest represents the parameters used to get a network.
No description provided by the author
ParallelContainersOptions represents additional options for parallel running.
ParallelContainersRequestError represents error from parallel request.
Reaper is used to start a sidecar container that cleans up resources.
TestcontainersConfig represents the configuration for Testcontainers.

# Interfaces

BindMounter can optionally be implemented by mount sources to support advanced scenarios based on mount.BindOptions.
Container allows getting info about and controlling a single container instance.
ContainerCustomizer is an interface that can be used to configure the Testcontainers container request.
ContainerMountSource is the base for all mount sources.
ContainerProvider allows the creation of containers on an arbitrary system.
DeprecatedContainer shows methods that were supported before, but are now deprecated Deprecated: Use Container.
No description provided by the author
GenericProvider represents an abstraction for container and network providers.
No description provided by the author
ImageBuildInfo defines what is needed to build an image.
LogConsumer represents any object that can handle a Log, it is up to the LogConsumer instance what to do with the log.
Logging defines the Logger interface.
Network allows getting info about a single network instance.
NetworkProvider allows the creation of networks on an arbitrary system.
ReaperProvider represents a provider for the reaper to run itself with The ContainerProvider interface should usually satisfy this as well, so it is pluggable.
TmpfsMounter can optionally be implemented by mount sources to support advanced scenarios based on mount.TmpfsOptions.
VolumeMounter can optionally be implemented by mount sources to support advanced scenarios based on mount.VolumeOptions.

# Type aliases

ContainerHook is a hook that will be called after a container is created It can be used to modify the state of the container after it is created, using the different lifecycle hooks that are available: - Created - Starting - Started - Stopping - Stopped - Terminating - Terminated For that, it will receive a Container, modify it and return an error if needed.
No description provided by the author
ContainerMountTarget represents the target path within a container where the mount will be available Note that mount targets must be unique.
functional option for setting the reaper image.
ContainerRequestHook is a hook that will be called before a container is created.
CustomizeRequestOption is a type that can be used to configure the Testcontainers container request.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author