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.
MIT License
Bot releases are visible (Hide)
If you are hosting your own module, please update all the custom options you created for the module, updating them to return an error in the case it occurs. This breaking change is needed to provide a more robust and consistent API for creating modules, allowing module authors to create custom code to customise the container avoiding panics.
Published by github-actions[bot] 6 months ago
Multiplexed
opt to combine stdout and stderr (#2452) @gustavosbarretoPublished by release-drafter[bot] 8 months ago
Published by release-drafter[bot] 8 months ago
If you are starting a log producer, it's now possible to pass log options in a variadic manner (at this moment only the log producer timeout option is available). So this breaking change will affect you if and only if you are assigning the StartLogProducer
method of a container to a variable.
Published by release-drafter[bot] 10 months ago
The ImageBuildInfo
interface now includes a new method: BuildOptions
, which is used to configure the build process.
This method returns the image build options when building a Docker image from a Dockerfile,
and it will apply some defaults and finally call the new BuildOptionsModifier
method from the FromDockerfile struct, if set.
This way it's possible to access Docker's types.ImageBuildOptions
type and modify it before the build process starts.
It now includes an Options
method that needs to be implemented. This method will allow configuring the exec options added in this PR for the WithStartupCommand
functional option.
If your code is implementing Executable
, you can embed the ExecOptions
struct in your own struct in order to satisfy the interface.
Please take a look at the RabbitMQ
test types to see examples on how to do it.
Published by github-actions[bot] 12 months ago
Info()
(#1779) @pmalekPublished by github-actions[bot] about 1 year ago
Published by release-drafter[bot] about 1 year ago
Published by github-actions[bot] about 1 year ago
Published by release-drafter[bot] about 1 year ago
Published by release-drafter[bot] about 1 year ago
As a consequence of the bugs described in #1359, we had to bump the Docker version to a major version, which moved the types.AuthConfig
type to registry.AuthConfig
. We used that type as public API, therefore, our API has changed the signature of the method of an interface, which is used to build images from a Dockerfile. Please look at #1394 to understand the changes in the GetAuthConfigs
method.
Published by release-drafter[bot] over 1 year ago
Published by release-drafter[bot] over 1 year ago
Published by release-drafter[bot] over 1 year ago
We want to inform you about an issue that occurred with the release, v0.20.0
. Due to an unintended error, the git tags associated with v0.20.0
were created in an inconsistent state. As a result, the tags were removed and recreated to accurately reflect the intended release state. This situation could have affected users relying on the Go proxy cache during the short time window between the initial release and the tag correction.
To address this issue, we have now created the patch release v0.20.1
, which is based on the correct state of the project and provides a seamless transition from v0.20.0
.
To ensure that you have the latest updates, we recommend updating your dependencies to use v0.20.1
instead of v0.20.0
to ensure you have the correct and stable version.
We apologise for any inconvenience this may have caused and appreciate your understanding. If you have any questions or encounter any issues, please don't hesitate to reach out to us.
Thank you for your continued support!
The signature of the testcontainers.NewDockerClient
has changed in order to provide a simpler API for the future changes, and for that reason we were forced to break it and simplify its signature, returning the client and an error, instead of an instance of the Testcontainers properties and the host. At the same time, the TestContainersConfig
struct representing the configuration properties has been renamed to TestcontainersConfig
, which is brings consistency with the name of the project.
wait.HostPortStrategy
(#1039) @RiverPhillipshashicorp/consul
in examples (#950) @eddumelendezPublished by release-drafter[bot] over 1 year ago
If you are relying in the deprecated RegistryCred
field from the ContainerRequest struct, then we broke your code π: the field is not used anymore therefore your own registry credentials won't be used. We expected that the credentials would live into the credential helpers, therefore would be automatically populated but, thanks to @srabraham, we discovered it's not. If that's your case you have to populate the DOCKER_AUTH_CONFIG
env var with your own credentials, as @srabraham did here https://github.com/testcontainers/testcontainers-go/pull/869#issuecomment-1480364456.
Published by release-drafter[bot] over 1 year ago
Published by release-drafter[bot] almost 2 years ago
Given the amount of issues after #476, causing consumers of this library to update their dependencies with multiple replace directives in their go.mod
files, we have moved compose code to a separate module. Therefore the majority of the users of the library will only need to replace Docker dependency with the one used in this library, which is simpler in terms of usage. Please see Install instructions for further information.
replace (
github.com/docker/docker => github.com/docker/docker v20.10.3-0.20221013203545-33ab36d6b304+incompatible // 22.06 branch
)
On the other hand, users of native Docker Compose code will still need all the replace directives, as described in the Compose docs.
Published by release-drafter[bot] almost 2 years ago
feat: support native docker compose api (#476) @baez90
Docker Compose v2 is implemented in Go, and for that reason we have decided to provide native Go support to Compose, deprecating the shell-escape based LocalDockerCompose
, which was invoking the local binary of compose. Given the version includes the Compose dependency, and the Docker folks added a replace directive until the upcoming Docker 22.06 release is out, we were forced to add it too, causing consumers of Testcontainers for Go to add the following replace directive too.
replace (
github.com/docker/cli => github.com/docker/cli v20.10.3-0.20221013132413-1d6c6e2367e2+incompatible // 22.06 master branch
github.com/docker/docker => github.com/docker/docker v20.10.3-0.20221013203545-33ab36d6b304+incompatible // 22.06 branch
github.com/moby/buildkit => github.com/moby/buildkit v0.10.1-0.20220816171719-55ba9d14360a // same as buildx
github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.2 // Can be removed on next bump of containerd to > 1.6.4
// For k8s dependencies, we use a replace directive, to prevent them being
// upgraded to the version specified in containerd, which is not relevant to the
// version needed.
// See https://github.com/docker/buildx/pull/948 for details.
// https://github.com/docker/buildx/blob/v0.8.1/go.mod#L62-L64
k8s.io/api => k8s.io/api v0.22.4
k8s.io/apimachinery => k8s.io/apimachinery v0.22.4
k8s.io/client-go => k8s.io/client-go v0.22.4
)
fix: do not prepend garbage in the container.Exec response (#624) @mdelapenya
The signature of the Exec
function on a container created by the library has been changed in what we thought it was a non-breaking change manner, using variadic arguments. But we confirmed that it could be a breaking change in the rare case where the Exec function is assigned to a variable.
// The original Exec function works here because its type is func(context.Context, []string),
// but the new Exec functionβs type is func(context.Context, []string, ...ProcessOption),
// so the assignment fails at compile time. For that reason we are moving it to this section.
var execFn func(ctx context.Context, cmd []string) = myContainer.Exec
feat: implement new MultiStrategy design (#580) @hhsnopek
This PR enhances how the wait.ForAll
strategy behaves: it will control the startup timeout and the deadline for all inner wait strategies, using two methods: WithStartupTimeoutDefault
, which sets the default timeout for all inner wait strategies; and WithDeadline
, which sets a time.Duration which limits all wait strategies. As a consequence, the already existing function WithStartupTimeout
has been deprecated from the multi-strategy struct.
feat: Auth config for build images (#602) @paulozenida
feat: log docker info from compose (#591) @mdelapenya
nginxC.Terminate
(#627) @ofey404Published by release-drafter[bot] almost 2 years ago
Before this change, when waiting for a SQL to be executed in a container it always checked against localhost
, but it could be the case that the database instance runs in a different container. For that reason, the library now supports passing the host where the database is running so that the wait.ForSQL
function needs the host as part of the input parameters.
- func ForSQL(port nat.Port, driver string, url func(nat.Port) string) *waitForSql {
+ func ForSQL(port nat.Port, driver string, url func(host string, port nat.Port) string) *waitForSql {
Published by release-drafter[bot] about 2 years ago
NetworkRequest
(#394) @aivinog1